Variables
Utilizing Variables to Tailor Conversations Across Diverse Environments
Last updated
Utilizing Variables to Tailor Conversations Across Diverse Environments
Last updated
Variables serve as labeled containers that hold data vital to the flow and logic of bot interactions. They dynamically capture and utilize information throughout a conversation, enabling personalized and contextually relevant dialogues.
Data Sources: Variables can store a wide range of data, including user inputs, platform-specific information, or system-generated values, facilitating a rich and personalized interaction.
Types of Variables:
Storage Variables: Capture user input-related data, such as a customer's name (customerName
).
Platform Variables: Hold platform-related data, like the version of the platform in use (PhoneV2
).
System Variables: Contain system-retrieved data, such as the caller's number (callerNumber
).
User Data Retention: Variables marked as 'User' may retain data indefinitely. It's vital to consider data retention policies and privacy regulations.
Personal Information (PI): Avoid storing personal information in variables to comply with data protection laws and safeguard user privacy.
The Definitions tab is where users can define and manage storage variables. Storage variables are used to retain and reference user input or system-generated data throughout the lifespan of a dialog session.
The Name field serves as a descriptor of the variable's content. It's important to choose names that are intuitive, in order to quickly understand what data is being stored.
The Lifetime field specifies the duration that the data will be saved within the system. The available options are:
Session
â Data stored with the 'Session' lifetime remains active only until the current interaction concludes. Once the session ends, the data is deleted.
Custom
â Here, you can define the duration for which the variable data is stored. The default value is set to indefinite
, which means the value will be retained indefinitely. If you do not wish to save this value permanently:
Click on the Custom dropdown menu.
Select either: in hours
, in days
, or in weeks
.
For example, if you select in days
, entering the value 30 will command the system to delete the data after 30 days:
Reflects how the variable is identified when interfaced through an API call. This may be the same as the variable name but can also differ if an API-specific naming convention is required.
Consistent Naming â Ensure variable names are intuitive and reflect their purpose.
API Naming â If the variable will be used in API interactions, ensure the 'Name in API' adheres to any external system's naming requirements.
Caution â Variables with 'session' lifetime are volatile and will be cleared after the session ends. Ensure that any data needed beyond the session is appropriately transferred or stored elsewhere.
Variables are organized into groups, each with a specific prefix to indicate its source and type:
Variables are referenced with double curly brackets using the handlebars expression syntax to differentiate and access their values within the conversation flow.
You can access the different types of variables using the autocomplete features. For more information, read our Autocomplete documentation.
Group | Prefix | Key | Type | Description |
---|---|---|---|---|
Intent
intent.
For a List of intent keys, see Intent.
string, object
Provides access to information regarding the received intent.
Slots
slots.
slots.<slotName>
string
Provides access to a slot of the last received intent.
Storage
storage.
storage.<variableName>
string
References previously set, dynamic values.
Text Snippet
text.
text.<textsnippetName>
string
References text snippets.
Environment
env.
env.<variableName>
string
References previously defined environment variables.
Platform
platform.
For a List of platform keys, see Platform.
string
Provides access to information regarding the platform the skill is used on.
Context
context.
For a List of context keys, see Context.
string, boolean, number, date
Provides access to a list of contextual conversation parameters.