Summary
Create variables to use across all your chatbot intents in Variables in Chatbot Studio. To use them in an intent, simply input the variable name surrounded by double curly brackets {} where you want it in the reply section of an intent.
Example
If you use your opening hours in many chatbot answers, you don't want to change each one by hand.
Using variables, you can change your opening hours in one place and they'll change automatically wherever your chatbot mentions your opening hours in a reply.
How does Studio use variables?
Before creating variables for your bot, it is important to understand how variables are used in Chatbot Studio:
- Variables keep information centralised, to be used consistently across multiple intents.
- Variables do not change over the course of a conversation.
- You can edit the contents of a variable at any time in Studio. Changing the value of a variable will affect all intents the variable is used in.
- You can not delete a variable once created.
Creating variables in Chatbot Studio
In the Chatbot Studio application open, and the correct bot selected:
- In the menu, click to select the Variables page.
You will see a list of the variables which already exist for this bot, if any. To add a new variable:
- Click the Add variable button.
- Type a Variable name. Variable names can only include letters, numbers and the underscore character.
- Type a Description of this variable's intended use.
- Click the Type drop-down list and select the type of information the variable will hold.
- Type the current Value for the variable.
- Click the Add variable button.
Using variables in your replies
When creating a new intent, or editing an existing one, complete normal intent information, including any queries or necessary conditions. Then, in the then bot replies section, to include a variabale in the reply:
- Type its name between two curly brackets, {{like_so}}.
If you do not remember the variable name, point your mouse over Bot variables available to see a tooltip of all variables associated with this bot.
- Continue to complete any further settings for the intent, then click Save when ready.
If you change the value for the variable in the Variables page, the answer will change across all intent replies that include that variable.