What are variables?
Variables are placeholders that store user input, data from external systems, or other important information that needs to be saved and reused later in the bot conversation.
They help maintain the context of the conversation, allowing the chatbot to retrieve data and respond appropriately based on previous interactions.
For example, collect the customer’s name, email address, and phone number, then have the bot automatically use these details in future interactions by storing them as variables.
These are categorized based on their scope, which determines where the variable is to be used. Variables are only accessible within their defined scope. There are four types used here: block variables, local variables, global variables, and session variables.
By using variables, you can personalize and tailor conversations within your GC chatbot, allowing for flexible and customized interactions.
Why use variables?
Helps maintain the context of the conversation, allowing the bot to refer to previous user inputs and respond accurately.
Allows the bot to retrieve and use data dynamically, making conversations more flexible and responsive to user needs.
Retrieves crucial information, such as user preferences or data from external systems, which can be used later in the conversation or across multiple interactions.
Variables help streamline conversation flows by reducing redundancy and ensuring that relevant data is easily accessible when needed.
By categorizing variables based on their scope (block variables, local variables, global variables, and session variables), they ensure that data is used appropriately within the intended parts of the conversation.
What are local variables and why use them?
To store predefined values, you can create a local variable and assign them wherever necessary in the flow. These variables are accessible anywhere within the same flow, but are not available outside of it.
For example, if you have a local variable named Coupon in a flow called Bookings, you can use this variable in any block within the Bookings flow. However, the Coupon variable cannot be accessed in a different flow called Grievances.
These variables are useful when you need to work with a predefined value rather than relying on user input as you would with Block variables. How to create local variables
1. Select the Flow in which you want to add the local variable.
2. Select the @ icon on the left side. The Add Variable dialog box will open.
3. In the dialog box, select the Variable Type as Local Variable.
4. Select Add Local Variable.
5. Provide the Variable Name, Data Type, and Variable Value.
6. Click Save.
Choosing the data type enables the entered local variable is validated as the selected type, ensuring they are correctly formatted.