1. Home
  2. Developers
  3. Verloop livechat APIs

Verloop livechat APIs

Start a particular recipe

Use the following script to set a particular recipe.

Verloop(function() {
    this.setRecipe("<recipe_id>");
});

Recipe id once set can not be changed for that session. If you are not setting any particular recipe, default recipe will be started upon opening the widget.

RecipeId can be found from the recipe edit url. For example :

https://yourcompanyname.verloop.io/admin/recipe/recipe_id. 

Open the widget

Use the following script to open the widget.

Verloop(function() {
    this.openWidget();
});

Note: Recipe can not be changed after the widget is opened for that session.

Close the widget

Use the following script to close the widget.

Verloop(function() {
    this.closeWidget();
});

Set user parameters

User parameters like name, email and phone number can be set via the API. The corresponding blocks from the recipe will be skipped if these parameters are set.

Verloop(function() {
    this.setUserParams({
        name: "<name_of_visitor>",
        email: "<email_of_visitor>",
        phone: "<phone_of_visitor>"
    });
});

Set custom parameters

You can set custom parameters and their values.

Verloop(function() {
    this.setCustomField("key", "value", { scope: "user" });
});

The value of “scope” variable can be either “user” or “room”. These custom fields will also be sent to your server via the webhook block. Learn More

Was this article helpful?

Related Articles