Developers

AddVariable

Usage

Use this method to capture a variable value in an ongoing conversation. The Chatbot can use this variable value at a later time in the conversation, for example to avoid repeatedly asking the user for the same information.

Mandatory parameters

Name Type Description
name string The name of the variable for which a value is captured. This variable must exist in the Chatbot instance.
value string The value to be captured for the variable.

Optional parameters

This method has no optional parameters.

Response data format

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

Example

chatbot.api.addVariable("first_name", "NewName");