Developers

AddMultipleVariables

Usage

Use this method to capture a list of variable values in an ongoing conversation. The Chat app can use these variable values at a later time in the conversation, for example to avoid repeatedly asking the user for the same information.

Mandatory parameters

Name Array property Type Description
variableList Array The list of variables and corresponding variable values to be captured.
name String The name of the variable for which a value is captured. The variable must exist in the Chat instance.
value String The value to be captured for the corresponding variable.

Optional parameters

This method has no optional parameters.

Response data format

This method calls the Chat API’s POST /conversation/variables/multiple endpoint. It returns a Promise with the API response data. Please refer to the Responses section of the endpoint on the Chat API Routes page for the response format.

Example

var variableList =
[
    {
      name: "first_name",
      value: "John"
    },
    {
      name: 'last_name',
      value: 'Doe'
    }
];

chatbot.api.addMultipleVariables(variableList);