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 global variables and why use them?
Global variables are shared across all departments and can be utilized in any conversation flow within your organization. For instance, you might establish a global variable for your support email address, allowing it to be used throughout all conversation flows.
Ensures uniform information across all flows
Reduces redundancy by avoiding repeated data entry
Simplifies updates and maintenance by centralizing changes
Can be utilized both within and outside individual flows
How to create global variables
1. Navigate to Setup > Self Service > Guided Conversations > Global Variable.
2. Select the Variable Type as a Global Variable.
3. Select Create Global Variable.
4. Provide the Variable Name, Data Type, and Variable Value.
Choosing the data type enables the entered global variable is validated as the selected type, ensuring they are correctly formatted.
5. Click Add.
Using the created global variable in a flow:
1. Create a block, then click the @ icon.
2. Select the global variable to be displayed.
Output in GC
How can you use block variables in your flow
- Company branding: Use a global variable to store the company name, tagline, or any standard messaging that should be consistent across all interactions.
- Operating hours: Create a global variable for your business hours, allowing the chatbot to inform users of availability across different conversation flows.
- Common URLs: Store URLs for frequently accessed resources like the company website, FAQs, or help center, making it easy to include them in multiple flows.
- Discount codes: Keep a global variable for active promotional codes or discounts, enabling the chatbot to offer these consistently across different sales or support conversations.
If the global variable is being edited, it will be reflected in wherever it has been used automatically.
The global variables can be reused multiple times according to the requirement.