GETTING STARTED
Kore.ai XO Platform
Virtual Assistants Overview
Natural Language Processing (NLP)
Concepts and Terminology
Quick Start Guide
Accessing the Platform
Working with the Builder
Building a Virtual Assistant
Using Workspaces
Release Notes
Current Version
Previous Versions
Deprecations

CONCEPTS
Design
Storyboard
Dialog Tasks
Overview
Dialog Builder
Node Types
Intent Node
Dialog Node
Entity Node
Form Node
Confirmation Node
Message Nodes
Logic Node
Bot Action Node
Service Node
Webhook Node
Script Node
Group Node
Agent Transfer
User Prompts
Voice Call Properties
Dialog Task Management
Connections & Transitions
Component Transition
Context Object
Event Handlers
Knowledge Graph
Introduction
Knowledge Extraction
Build Knowledge Graph
Add Knowledge Graph to Bot
Create the Graph
Build Knowledge Graph
Add FAQs
Run a Task
Build FAQs from an Existing Source
Traits, Synonyms, and Stop Words
Manage Variable Namespaces
Update
Move Question and Answers Between Nodes
Edit and Delete Terms
Edit Questions and Responses
Knowledge Graph Training
Knowledge Graph Analysis
Knowledge Graph Import and Export
Importing Knowledge Graph
Exporting Knowledge Graph
Creating a Knowledge Graph
From a CSV File
From a JSON file
Auto-Generate Knowledge Graph
Alert Tasks
Small Talk
Digital Skills
Digital Forms
Views
Introduction
Panels
Widgets
Feedback Survey
Train
Introduction
ML Engine
Introduction
Model Validation
FM Engine
KG Engine
Traits Engine
Ranking and Resolver
NLP Configurations
NLP Guidelines
Intelligence
Introduction
Contextual Memory
Contextual Intents
Interruption Management
Multi-intent Detection
Amending Entities
Default Conversations
Sentinment Management
Tone Analysis
Test & Debug
Talk to Bot
Utterence Testing
Batch Testing
Conversation Testing
Deploy
Channels
Publish
Analyze
Introduction
Conversations Dashboard
Performance Dashboard
Custom Dashboards
Introduction
Meta Tags
Dashboards and Widgets
Conversations History
Conversation Flows
Feedback Analytics
NLP Metrics
Containment Metrics
Usage Metrics
Smart Bots
Universal Bots
Introduction
Universal Bot Definition
Universal Bot Creation
Training a Universal Bot
Universal Bot Customizations
Enabling Languages
Store
Manage Assistant
Plan & Usage
Overview
Usage Plans
Support Plans
Invoices
Authorization
Multilingual Virtual Assistants
Masking PII Details
Variables
IVR Settings
General Settings
Assistant Management
Data Table
Table Views
App Definitions
Sharing Data Tables or Views

HOW TOs
Build a Flight Status Assistant
Design Conversation Skills
Create a Sample Banking Assistant
Create a Transfer Funds Task
Create a Update Balance Task
Create a Knowledge Graph
Set Up a Smart Alert
Design Digital Skills
Configure Digital Forms
Configure Digital Views
Add Data to Data Tables
Update Data in Data Tables
Add Data from Digital Forms
Train the Assistant
Use Traits
Use Patterns for Intents & Entities
Manage Context Switching
Deploy the Assistant
Configure an Agent Transfer
Use Assistant Functions
Use Content Variables
Use Global Variables
Web SDK Tutorial
Widget SDK Tutorial
Analyze the Assistant
Create a Custom Dashboard
Use Custom Meta Tags in Filters

APIs & SDKs
API Reference
API Introduction
API List
API Collection
koreUtil Libraries
SDK Reference
SDK Introduction
SDK Security
SDK Registration
Web Socket Connect and RTM
Using the BotKit SDK
BotKit SDK Tutorial - Blue Prism

ADMINISTRATION
Introduction
Assistant Admin Console
Administration Dashboard
User Management
Add Users
Manage Groups
Manage Roles
Assistant Management
Enrollment
Invite Users
Send Bulk Invites
Import User Data
Synchronize Users from AD
Security & Compliance
Using Single-Sign On
Security Settings
Cloud Connector
Analytics
Billing
  1. Home
  2. Docs
  3. Virtual Assistants
  4. Bot Settings
  5. Bot Management
  6. Using Bot Variables6 min read

Using Bot Variables6 min read

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 – Environment and Content.

Environment Variables

(Previously called Global Variables)

Environment 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 environment 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

Post the release of v8.1 of the platform, for on-prem installations, multiple value sets can be stored for these environment variables using Collections, refer here for more.

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
  2. Select the Build top menu
  3. From the left menu, under Configurations, select either Environment Variables or Content Variables
  4. 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.
    • Assign a Namespace if enabled (refer here for more).
  5. Click Save.
  6. 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 Build > Configurations > 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 Environment Variables

You can invoke an environment 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 environment 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 a 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 Build > Configurations -> (Environment/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 backup 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 environment and content variables.

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

  • key (mandatory) – name of the variable
  • scope  – the 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 – the value of the variables
  • variableType (if not set will default to env)-
    • env for Environment 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