Creating Global Variables

Creating Global Variables

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.
Idea
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.
Info
Choosing the data type enables the entered global variable is validated as the selected type, ensuring they are correctly formatted.
Notes
Points to note when creating a global variable:
The following data types are available-
  1. String
  2. Number
  3. Image
  4. Audio
  5. Video
  6. Object
  7. Date
  8. Date and Time
  9. File
The maximum size of Image, Audio, Video, and File that can be added as global variable is 14 MB. If the channel set is WhatsApp, then this limit would be 10 MB.


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

  1. Company branding: Use a global variable to store the company name, tagline, or any standard messaging that should be consistent across all interactions.
  2. Operating hours: Create a global variable for your business hours, allowing the chatbot to inform users of availability across different conversation flows.
  3. 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.
  4. 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.
Notes
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.
Info
Global variables can be utilized in any conversation flow within your organization. 

Variable validations  

Variable validations  

String Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed

Variable value

Yes

Max 100

HTML tags not allowed

Description

No

Max 100

Characters <, >, “, ’ not allowed


Number Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed

Variable value

Yes

Max 100

Must contain a valid number


Media Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed

Variable value

Yes

Max size 14 MB

Accepts supported media files


Object Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed

Variable value

Yes

Must contain valid nested key value pairs

 

Name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed

Value

Yes

Max 100 for string or number; Max 14 MB for media

HTML tags not allowed for string values


Date Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed


Date Time Variable  

Field

Mandatory

Character limit

Additional details

Variable name

Yes

Max 250

Cannot start with a number; Only letters, numbers, and underscore allowed