Variables are placeholders for information that is based on the user's interaction with your chatbot. For example, your chatbot might:
- Ask the user their name, store their reply in a variable, and use the variable to address them personally in a later passage.
- Ask the user which product they use with some Quick Replies, store the value of which Quick Reply they press in a variable, and use that value in a later conversation.
- Direct the flow of the conversation to a different passage based on the value of a variable.
Variables are set by actions and can have a default value that is used unless the value is set by an action. If a variable does not have a default value, its value is blank until it has been set. When you use variables in chatbot content, it's important to either:
- Write your content so a blank variable won't look out of place.
- Make sure your conversation flow will set the variable value before the chatbot tries to use it, or set a default value for the variable.
You can use TestBot to check your variables through your conversation flow:
- When the TestBot Log panel is open, variables, constants, and entities are displayed in their placeholder chip colours so you can see where they've been used.
- When a variable has a value, including a default value, the variable name and its value is displayed at the bottom of the Log panel. If the value is cleared, the variable name is removed from the Log panel.
You can set starting values for variables when you configure which passage to start the test from.