Chatbot Overview
Conversational Bots
Intents & Entities
Intelligent Bots
Kore.ai's Approach
Kore.ai Conversational Platform
Bot Concepts and Terminology
Natural Language Processing (NLP)
Bot Types
Bot Tasks
Starting with Kore.ai Platform
How to Access Bot Builder
Working with Kore.ai Bot Builder
Building your first Bot
Getting Started with Building Bots
Using the Dialog Builder Tool
Creating a Simple Bot
Release Notes
Latest Updates
Older Releases
Bot Builder
Creating a Bot
Design
Develop
Storyboard
Dialog Task
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Message Nodes
Confirmation Nodes
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Connections & Transitions
Managing Dialogs
Prompt Editor
Alert Tasks
Alert Tasks
Ignore Words and Field Memory
Digital Views
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Small Talk
Action & Information Task
Action Tasks
Information Tasks
Establishing Flows
Natural Language
Overview
Machine Learning
ML Model
Fundamental Meaning
NLP Settings and Guidelines
Knowledge Graph Training
Traits
Ranking and Resolver
NLP Detection
Bot Intelligence
Overview
Context Management
Session and Context Variables
Context Object
Dialog Management
Sub-Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Default Conversations
Default Standard Responses
Channel Enablement
Test & Debug
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
Publishing your Bot
Analyzing your Bot
Overview
Dashboard
Custom Dashboard
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
koreUtil Libraries
Universal Bots
Defining
Creating
Customizing
Enabling Languages
Smart Bots
Defining
Sample Bots
Github
Asana
Travel Planning
Flight Search
Event Based Bot Actions
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Bot Management
Using Bot Variables
API Guide
API Overview
API List
API Collection
SDKs
SDK Overview
SDK Security
SDK App Registration
Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Widget SDK Tutorial
Widget SDK – Message Formatting and Templates
Web Socket Connect & RTM
Using the BotKit SDK
Installing
Configuring
Events
Functions
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
Dashboard
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Enrollment
Inviting Users
Bulk Invites
Importing Users
Synchronizing Users from AD
Security & Compliance
Using Single Sign-On
Security Settings
Cloud Connector
Analytics
Billing
How Tos
Creating a Simple Bot
Creating a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configuring Digital Views
Custom Dashboard
Custom Tags to filter Bot Metrics
Patterns for Intents & Entities
Build Knowledge Graph
Global Variables
Content Variables
Using Bot Functions
Configure Agent Transfer
  1. Home
  2. Docs
  3. Bots
  4. Bot Administration
  5. Bots Management
  6. Using Bot Variables

Using Bot Variables

Bot variables help you capture values that are commonly used by different tasks, nodes, and other bot elements. You can configure a bot variable as a key-value pair once in the bot settings and substitute key with value at runtime during the conversation flow.

By capturing frequently used values in a single place, bot variables provide the advantages of reusability and consistency.

For example, let’s say you are testing a flight booking bot using a staging endpoint. If you configure the endpoint as a variable, it helps you to call the API from several places quickly. When you want to change the staging endpoint to production while publishing the bot, it is easy.

Similarly, variables can be used to externalize content for messages and prompts from the dialog flow definition.

Kore.ai platform allows bot developers to define two types of variables – Global and Content.

Global Variables

Global variables are a primary type of bot variables where you define a key-value pair and use the variable across the bot. As the variables are declared globally, they can be used at any point in the bot configuration.

Some of the typical use-cases where a developer can use global variables are:

  • To manage the bot across environments having different endpoint URLs. The bot can be exported and imported based on the environment, and the infrastructure team will need to modify only the variable configuration file.
  • To define and manage the bot response that is repeated within the bot configuration as variables.
  • Authorization Token
  • Channel-related tokens and URLs

Content Variables

Bot building essentially requires extensive content management efforts. When it comes to multi-language bots, it also involves tedious coordination efforts between the developers and globally-distributed content authors or copyright team.

Content variables enable you to overcome that by abstracting bot flow development efforts from authoring or editing the content. Using Content Variables, programmers can avoid hard-coding the bot content, such as prompts, messages, or any data presented to the user, into bot components, and instead point to specific variables in centrally managed Content Variables files for each bot language.
You can export the language-specific content variable files to content editors, without exposing any bot configurations. The writers can author the content in the exported file, which you can import back into the bot.

Defining Bot Variables

Follow these steps to add or edit bot variables:

  1. Open the bot for which you want to add the variables, and go to Settings > Config Settings.
  2. Select either Global Variables or Content Variables section
  3. On the Variables page, click Add Variable and enter the following details:
    • Variable Name: Enter a name without any special characters, for example, Bots Environment.
    • Value: Add a String expression. This string replaces the variable everywhere it is invoked.
      Note: For content variables, you need to enter different values for each bot language. Refer to the next section to learn how.
    • Enter developer notes in the Notes field. While this is an optional field, entering useful notes can help the developer working on the target bot to understand and provide relevant values.
    • Group can be used to categorize the variable.
  4. Click Save.
  5. Repeat steps 3-5 to add or edit more variables.

Entering Language-Specific Values

To add language-specific values for content variables, you first need to switch the bot language. You can switch the language by clicking the name of the currently-enabled language from the top-right corner of the bot’s page and then selecting another language as follows:

After switching the language, go to Settings > Config Settings > Content Variables page and click the edit icon next to the relevant variable. Replace the text in the Value field in the enabled language.

Using Global Variables

You can invoke a global variable in plain text mode (Standard editor) using the following syntax:
{{env.variableName}}

If you are using it in JavaScript mode, it is env.variableName
Here’s an example from a bot that uses two global variables called botType and parameters to determine different bot environments such as development, testing, and production. The following script node in one of the bot’s tasks captures the base URL of the bot, depending on the current bot environment.

The URL in the following service node changes based on the captured URL

Using Content Variables

You can invoke a content variable in plain text mode (Standard editor) using the following syntax.
{{content.variableName}}

If you are using it in JavaScript mode, it is content.variableName
Here’s an entity node of a multi-language flight booking bot that captures the source airport of the users. It uses a content variable instead of hard-coded user prompt.

When the bot reaches this node as a part of the user interaction, the user prompt changes depending on the language of the interaction (provided you entered the respective variable values for all the enabled languages).

Importing and Exporting

You can import and export bot variables between bots.

  1. On any of the Bot Variables page accessible from Settings > Config Settings -> (Global/Content) Variables,
  2. Click the ellipses next to Add Variables
  3. To Import: Select Import to import variables from a JSON or CSV file
    • Since the import will replace the existing variables, you are advised to take a back up of the same.
    • After taking a Backup, Proceed with the Import
    • Select a JSON or CSV file to import (see below for the file format)
  4. To Export: From Export select the preferred format for the export file:
    • Bot variables are exported in the form of a JSON, CSV file based upon your selection.
    • This file includes both global and content variables.

The Bot Variable file contains the following information, same needs to be present in your Import file. CSV files need a header row. You are advised to refer to Export (or backup) file and use the same format for the Import file.

  • key (mandatory) – name of the variable
  • scope  – scope of the variable corresponds to the Setup Option at the time of variable declaration (if not provided will be set to prePopulated) and can be
    • prePopulated,
    • askOnInstall, or
    • hidden
  • value – value of the variables
  • variableType (if not set will default to env)-
    • env for Global and
    • locale for Content Variable
  • audioTag -for the player details in case IVR enabled
  • group – group name
  • hint – description of the variable

Sample CSV file:

Sample JSON file:

[
  {"key":"hosturl",
   "value":"https://bots.kore.ai",
   "hint":"This is the URL of environment which can be used across the endpoints configured in the bot",
   "audioTag":"",
   "variableType":"env",
   "scope":"prePopulated",
   "group":"URLS"}
]
Menu