OVERVIEW
Virtual Assistants
Kore.ai Platform
Key Concepts
Natural Language Processing (NLP)
Accessing Platform
VIRTUAL ASSISTANTS
Virtual Assistant Builder
Virtual Assistant Types
Getting Started
Creating a Simple Bot
SKILLS
Storyboard
Dialog Task
Introduction
Dialog Builder (New)
Dialog Builder (Legacy)
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Bot Action Node
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Manage Dialogs
User Prompts
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Build
Alert Tasks
Introduction
Ignore Words and Field Memory
How to Schedule a Smart Alert
Small Talk
Digital Views
Overview
Configuring Digital Views
Digital Forms
Overview
How to Configure Digital Forms
NATURAL LANGUAGE
Overview
Machine Learning
Introduction
Model Validation
Fundamental Meaning
Introduction
NLP Guidelines
Knowledge Graph
Traits
Introduction
How to Use Traits
Ranking and Resolver
Advanced NLP Configurations
INTELLIGENCE
Overview
Context Management
Overview
Session and Context Variables
Context Object
How to Manage Context Switching
Manage Interruptions
Dialog Management
Sub-Intents & Follow-up Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Event Based Bot Actions
Default Conversations
Default Standard Responses
TEST & DEBUG
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
CHANNELS
PUBLISH
ANALYZE
Overview
Dashboard
Custom Dashboard
Overview
How to Create Custom Dashboard
Conversation Flows
NLP Metrics
ADVANCED TOPICS
Universal Bots
Overview
Defining
Creating
Training
Customizing
Enabling Languages
Store
Smart Bots
Defining
koreUtil Libraries
SETTINGS
Authorization
Language Management
PII Settings
Variables
Functions
IVR Integration
General Settings
Management
Import & Export
Delete
Versioning
Collaborative Development
Plan Management
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
ADMINISTRATION
HOW TOs
Creating a Simple Bot
Creating a Banking Bot
Context Switching
Using Traits
Schedule a Smart Alert
Configure UI Forms
Add Form Data into Data Tables
Configuring Digital Views
Add Data to Data Tables
Update Data in Data Tables
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
Update Balance Task
Transfer Funds Task
RELEASE NOTES
  1. Home
  2. Docs
  3. Virtual Assistants
  4. How Tos
  5. How to use Global Variables

How to use Global Variables

Kore.ai bots platform provides a way to declare and use variables within the bot. These variables can be used to capture values that are commonly used by different tasks, nodes, and other bot elements

In this How-To, we will explore a scenario in a Banking Bot, where Bot Variables can be used. We will see how Global Variables can be used to pass API endpoints and change them easily when migrating from development to testing to production environments.

For details on what Bot Variables are and how they are implemented in the Kore.ai Bots platform, refer here. For a use case with Content Variables, refer here.

Problem Statement

In our Banking Bot, we have two tasks:

  1. Get Balance which makes a service call with a given account number to get the balance in that account
  2. Update Balance which makes a service call to update a given account with the specified amount.
  3. Both the above tasks call the same service and the service API endpoint changes for development, testing, and production environments.
  4. Changing the service call in both the Dialog Tasks is cumbersome and leading to errors, if the change is not done properly.

In this document, we will see how Global Variable can be used to store the API endpoint and use it for the service calls.

Pre-requisites

  • Bot building knowledge
  • A Banking Bot with the dialogs as mentioned below:
    • Get Balance – Dialog task prompting the user for their Account Number and displaying the available balance in the account.
    • Update Account – Dialog task prompting the user for Account Number that needs to be updated, the Amount to be updated and whether the amount needs to be credited or debited and updating the Account balance accordingly.

Implementation

Declaring a Global Variable to hold the API endpoint will help the transition easier and faster.

  1. Open the Banking Bot.
  2. Select the Build tab from the top menu
  3. From Configurations select the Environment Variables section.
  4. Click Add Variable to open the corresponding window.
  5. Enter Variable Name and Variable Value. For this use case, were are calling the Variable accountURL, and for value, we are entering the Service API call endpoint.
  6. Save.
  7. Now open the Get Balance Dialog Task.
  8. Select the GetAccountBalance Service Node.
  9. Click Edit Request under the Request Definition
  10. Replace the request URL with the Global Variable created above. using the env prefix followed by any parameters needed. In this case:
    {{env.accountURL}}{{context.entities.AccountNumber}}
  11. Repeat for Update Balance Dialog Task.
  12. Now when you Export and Import the Bot to another environment, all you need to worry about is to change the value of the Global Variable and the changes will be effective in both the Dialog Tasks.
Menu