Chatbot Overview
Conversational Bots
Intents & Entities
Intelligent Bots's Approach Conversational Platform
Bot Concepts and Terminology
Natural Language Processing (NLP)
Bot Types
Bot Tasks
Starting with Platform
How to Access Bot Builder
Working with 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
Dialog Task
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Managing Dialogs
User Prompts
Alert Tasks
Alert Tasks
Ignore Words and Field Memory
Digital Forms
Digital Views
Knowledge Graph
Importing and Exporting
Knowledge Extraction
Small Talk
Action & Information Task
Action Tasks
Information Tasks
Establishing Flows
Natural Language
Machine Learning
ML Model
Fundamental Meaning
NLP Settings and Guidelines
Knowledge Graph Training
Ranking and Resolver
NLP Detection
Advanced NLP Configurations
Bot Intelligence
Context Management
Session and Context Variables
Context Object
Dialog Management
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
Custom Dashboard
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
Data Table
Universal Bots
Enabling Languages
Smart Bots
Sample Bots
Travel Planning
Flight Search
Event Based Bot Actions
koreUtil Libraries
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Manage Sessions
Bot Management
Bot Versioning
Using Bot Variables
API Guide
API Overview
API List
API Collection
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
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Inviting Users
Bulk Invites
Importing Users
Synchronizing Users from AD
Security & Compliance
Using Single Sign-On
Security Settings
Cloud Connector
How Tos
Creating a Simple Bot
Creating a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configure Digital 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
  1. Home
  2. Docs
  3. Bots
  4. Intelligence
  5. Context Management

Context Management

Effective context management is important because it allows bots to interact with users in a way that is easier, quicker, and more helpful – and less robotic and scripted. Contextual data helps users complete tasks faster and allows you to create more natural, human-like back and forth conversations.

Take for example the following conversation:
User: What are the annual charges for a credit card?
Bot: First year is free and after that, it's $xxx
User: Sounds great, I would like to apply for one.

In the above conversation, the “apply” is in the context of “credit card”. The Bot should not be asking the user whether they would like to apply for a credit card or a debit card. The context from the previous intent, FAQ – credit card annual charges, should be passed to the intent, Apply for a card. Bots Platform allows you to capture and reuse contextual data for a large variety of scenarios, so you can create more complex use cases and redefine the enterprise customer experience. The following are examples of a few such scenarios:

  • Sharing context across intents, FAQs: As seen from the above example, maintaining context for all intents i.e. dialog tasks, FAQs, makes it easy to customize the user experience
  • Context-driven FAQs: Certain intents (tasks or FAQs) can be made available only when certain other intents (tasks or FAQs) are in the context.
    Example: FAQ intent ‘What are the meal options available’ should be available only when ‘Book a flight’ task is in the context
  • Follow-up Intent: Context of the current intent can be used to identify subsequent intents from the user utterances.
    Example: User utterance ‘what are the charges’ should be responded using FAQ intent ‘what are the charges for Platinum credit card’ if the user’s previous intent was ‘what are the benefits of Platinum credit card
  • Sharing Entity Values across Intents: Entity values or conversation flows can be driven using the previous intent’s context information.
    Example: ‘City Name’ entity in ‘Check weather’ intent can be pre-populated if the user has executed ‘Check flight status’ intent and has provided value for ‘Destination City’ entity.

This document talks about the concepts behind the implementation of context management in the Bots platform. For a detailed step-by-step example refer here.

Use Case Example

User: When is my flight to Singapore?
Bot: Your flight from New York to Singapore is confirmed for Jun 20th.
User: Do I need a Visa?
Bot: Yes, you need a visa to visit Singapore for business or tourism
User: I would like to apply for one
Bot: Sure I can help with Visa to Singapore. Let me know the duration of the stay

To achieve the above conversation the context object can be used as follows:

  • Flight Booking Enquiry would emit the destination city entity value
  • Visa FAQ would use the entity value emitted by the Booking Enquiry Intent
  • Visa Application would consume the terms Visa and Singapore from the Visa FAQ

This article will help you in achieving the above scenario.


Context management involves the following steps:

  • Output Context to define tags that indicate the current intent being executed
  • Intent Preconditions to extract the output context tags for scoping the subsequent intent detection
  • Intent Detection Rules for detecting the relevant intents
  • KC – Contextual Intent Detection using context tags to identify the terms/nodes from the FAQs
  • Conversation Flows to customize the flows

Output Context

Context tags can be generated and stored in the context object to be used for managing the Bot behavior and user experience. The platform creates a context object for every user intent, like dialog tasks and FAQs (refer here for more on Context Object).

Default Contexts Tags:
Intent name, Entity names, and FAQ Term/Node names are emitted by default.

Custom Context Tags:
Additionally, the following can be defined to be included in the Context Object:

  • Context tags – You can add context tags from the NLP settings for Dialog, Action, Alert, and Info Tasks, and Entities.
  • Entity Value – You set an option to indicate whether entity values captured should be emitted or not for each entity node.
  • Use context tags for finding FAQ – You can indicate whether KG paths to be shortlisted using context tags

Dialog Tasks

The platform supports emitting details of a dialog task when executed by the user:

  • Intent name is emitted as a contextual tag for all dialog tasks when the task execution is initiated.
  • You can add any additional tags from the NLP Properties tab of the Dialog task.
  • You can emit output context tags from any place where JavaScript be written (script node, advanced prompts, ‘run a script’ option, etc.) using the contextTags.add(string value).

Other Tasks

The platform supports emitting details of the action, alert and info tasks when executed by the user:

  • Task name is emitted as a contextual tag for all action, alert and info tasks when the task execution is initiated.
  • You can add any additional tags at the time of Task creation under More Options.

    or from the General Settings
  • You can also emit output context tags from pre-processors or post-processors using the contextTags.add(string value).


Entity values captured from end users can be emitted based on the:

  • Auto emit the entity values captured switch. Entity Value Tags will be emitted as shown in the following section.
  • You have the option to add any additional tags.

Knowledge Graph

  • Node/term name is emitted as a contextual tag for all mandatory and optional terms present in the path qualified when a question is answered.
  • You can add any additional tags per term from the Settings page for the term/node.
  • You can also emit output context tags from advanced prompts using the contextTags.add(string value).

Intent Preconditions

Intent Preconditions can be used in defining the intent detection scope for intents and FAQs. These are a set of conditions that need to be fulfilled for the intent/FAQ to be detected and executed.

Dialog Tasks

Intent preconditions for dialog intents can be set to define when a dialog should be detected i.e. making a dialog available for detection only when specific tags are available in the context

  1. You can add one or more intent pre-conditions for making a dialog intent available
  2. Dialog intents with preconditions will be detected only if the defined preconditions are met
  3. The intent with a precondition set will be treated as a sub-intent and will be part of the Linked Task Exception behavior from the Dialog level Hold and Resume settings.

Other Tasks

Intent preconditions for action, alert and info tasks can be set to define when a task should be detected i.e. making a task available for detection only when specific tags are available in the context

  1. You can add one or more intent pre-conditions for making a task intent available
  2. Task intents with preconditions should be detected only if the defined preconditions are met

Knowledge Graph

Intent preconditions for Knowledge Graph can be associated with terms

  1. You can define intent preconditions for any of the terms present in the Knowledge Graph
  2. Paths that contain terms with preconditions would be qualified only if the preconditions are met

Intent Detection

Contextual intent detection helps in detecting relevant intents using the output context set by previously executed intents.


You can define ‘Rules’ for identifying contextually relevant intents by using output context tags the same as traits (refer here for more).

Knowledge Graph

The platform consumes the output context tags and uses them for improving intent detection in the Knowledge Graph engine based on the flag set by the developer. This flag will ensure that the context tags are used to qualify paths in Knowledge Graph. Context tags are used to extract terms and these terms are clubbed with any other terms present in user utterance. The consolidated list of terms is used for qualifying the path.

You can set this configuration by:

  1. From the Left Navigation, Natural Language -> Training, select Thresholds & Configurations
  2. Click Knowledge Graph
  3. Locate Qualify Contextual Paths  and set it to Yes

Conversation Flows

The context tags available in the context object can be used to customize the conversation flows.

These can be used:

  • to pre-populate entity values
  • to define transitions conditions
  • for custom conversation flow

Script to access the context tags would be

  • from the current context: context.currentTags.tags
  • from the previous context: context.historicTags[0].tags

Recommended Readings:

You might want to read about: