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.
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. |
This method has no optional parameters.
This method calls the Chat 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 Chat API Routes page for the response format.
chatbot.api.addVariable("first_name", "NewName");