What are Variables?
Variables are used to store and manage data within the flow. They can be used to capture user inputs, store information, or pass data between different components of the flow. Variables help in maintaining context and continuity in the conversation flow.
Role of Variables
-
Variables help in capturing and storing user inputs during the conversation.
-
They enable the chatbot to remember information provided by the user and use it to personalize responses or actions.
-
Variables can be used to pass data between different components of the flow and maintain context throughout the conversation.
For example, you can create a variable to store the userβs name when they introduce themselves. This variable can then be used to personalize responses or address the user by name in subsequent interactions.
How to use them in Chatbot Studio?
-
Go to the
Model
section in the Chatbot Studio. -
From the left panel, click on
Variables
. -
Click on
Add Variable
to create a new variable. -
Define the variable by selecting its type (FLOW,SESSION,VISITOR) and providing a name.
-
Use the variable in the flow by referencing it with double curly braces (e.g.,
{{FLOW.variable_name}}
). -
Variables can be used to capture user inputs, store information, or pass data between different components of the flow.
FLOW.last_response
- The last response in the flowFLOW.last_utterance
- The last message sent by the userFLOW.{variable_of_your_choice}
- Custom variable that you created for the flow
SESSION.status
- Current session status (open/closed)SESSION.chat_mode
- Chat mode: 1 for bot mode, 2 for awaiting, 3 for operator modeSESSION.state
- Session state: resolved, pending, or unresolved
VISITOR.name
- Name of the visitorVISITOR.region
- Region/location of the visitorVISITOR.language
- Visitorβs preferred languageVISITOR.browser
- Visitorβs web browserVISITOR.os
- Visitorβs operating systemVISITOR.status
- Visitorβs status (away/online/offline)
CONTACT.name
- Name of the contactCONTACT.email
- Email address of the contactCONTACT.phone
- Phone number of the contactCONTACT.company
- Company name of the contactCONTACT.country
- Country of the contactCONTACT.city
- City of the contactCONTACT.region
- Region inside a cityCONTACT.tags
- Can be Custom String tags