GETTING STARTED
Kore.ai XO Platform
Virtual Assistants Overview
Natural Language Processing (NLP)
Concepts and Terminology
Quick Start Guide
Accessing the Platform
Navigating the Kore.ai XO Platform
Building a Virtual Assistant
Help & Learning Resources
Release Notes
Current Version
Recent Updates
Previous Versions
Deprecations
Request a Feature
CONCEPTS
Design
Storyboard
Overview
FAQs
Conversation Designer
Overview
Dialog Tasks
Mock Scenes
Dialog Tasks
Overview
Navigate Dialog Tasks
Build Dialog Tasks
Node Types
Overview
Intent Node
Dialog Node
Dynamic Intent Node
GenAI Node
GenAI Prompt
Entity Node
Form Node
Confirmation Node
Message Nodes
Logic Node
Bot Action Node
Service Node
Webhook Node
Script Node
Process Node
Agent Transfer
Node Connections
Node Connections Setup
Sub-Intent Scoping
Entity Types
Entity Rules
User Prompts or Messages
Voice Call Properties
Knowledge AI
Introduction
Knowledge Graph
Introduction
Terminology
Build a Knowledge Graph
Manage FAQs
Knowledge Extraction
Import or Export Knowledge Graph
Prepare Data for Import
Importing Knowledge Graph
Exporting Knowledge Graph
Auto-Generate Knowledge Graph
Knowledge Graph Analysis
Answer from Documents
Alert Tasks
Small Talk
Digital Skills
Overview
Digital Forms
Digital Views
Introduction
Widgets
Panels
Session and Context Variables
Context Object
Intent Discovery
Train
NLP Optimization
ML Engine
Overview
Model Validation
FM Engine
KG Engine
Traits Engine
Ranking and Resolver
Training Validations
NLP Configurations
NLP Guidelines
LLM and Generative AI
Introduction
LLM Integration
Kore.ai XO GPT Module
Prompts & Requests Library
Co-Pilot Features
Dynamic Conversations Features
Intelligence
Introduction
Event Handlers
Contextual Memory
Contextual Intents
Interruption Management
Multi-intent Detection
Amending Entities
Default Conversations
Conversation Driven Dialog Builder
Sentinment Management
Tone Analysis
Default Standard Responses
Ignore Words & Field Memory
Test & Debug
Overview
Talk to Bot
Utterance Testing
Batch Testing
Conversation Testing
Conversation Testing Overview
Create a Test Suite
Test Editor
Test Case Assertion
Test Case Execution Summary
Glossary
Health and Monitoring
NLP Health
Flow Health
Integrations
Actions
Actions Overview
Asana
Configure
Templates
Azure OpenAI
Configure
Templates
BambooHR
Configure
Templates
Bitly
Configure
Templates
Confluence
Configure
Templates
DHL
Configure
Templates
Freshdesk
Configure
Templates
Freshservice
Configure
Templates
Google Maps
Configure
Templates
Here
Configure
Templates
HubSpot
Configure
Templates
JIRA
Configure
Templates
Microsoft Graph
Configure
Templates
Open AI
Configure
Templates
Salesforce
Configure
Templates
ServiceNow
Configure
Templates
Stripe
Configure
Templates
Shopify
Configure
Templates
Twilio
Configure
Templates
Zendesk
Configure
Templates
Agents
Agent Transfer Overview
Custom (BotKit)
Drift
Genesys
Intercom
NiceInContact
NiceInContact(User Hub)
Salesforce
ServiceNow
Configure Tokyo and Lower versions
Configure Utah and Higher versions
Unblu
External NLU Adapters
Overview
Dialogflow Engine
Test and Debug
Deploy
Channels
Publishing
Versioning
Analyze
Introduction
Dashboard Filters
Overview Dashboard
Conversations Dashboard
Users Dashboard
Performance Dashboard
Custom Dashboards
Introduction
Custom Meta Tags
Create Custom Dashboard
Create Custom Dashboard Filters
LLM and Generative AI Logs
NLP Insights
Task Execution Logs
Conversations History
Conversation Flows
Conversation Insights
Feedback Analytics
Usage Metrics
Containment Metrics
Universal Bots
Introduction
Universal Bot Definition
Universal Bot Creation
Training a Universal Bot
Universal Bot Customizations
Enabling Languages
Store
Manage Assistant
Team Collaboration
Plan & Usage
Overview
Usage Plans
Templates
Support Plans
Invoices
Authorization
Conversation Sessions
Multilingual Virtual Assistants
Get Started
Supported Components & Features
Manage Languages
Manage Translation Services
Multiingual Virtual Assistant Behavior
Feedback Survey
Masking PII Details
Variables
Collections
IVR Settings
General Settings
Assistant Management
Manage Namespace
Data
Overview
Data Table
Table Views
App Definitions
Data as Service
HOW TOs
Build a Travel Planning Assistant
Travel Assistant Overview
Create a Travel Virtual Assistant
Design Conversation Skills
Create an ‘Update Booking’ Task
Create a Change Flight Task
Build a Knowledge Graph
Schedule a Smart Alert
Design Digital Skills
Configure Digital Forms
Configure Digital Views
Train the Assistant
Use Traits
Use Patterns
Manage Context Switching
Deploy the Assistant
Use Bot Functions
Use Content Variables
Use Global Variables
Use Web SDK
Build a Banking 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
Composite Entities
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
Intent Scoping using Group Node
Analyze the Assistant
Create a Custom Dashboard
Use Custom Meta Tags in Filters
Migrate External Bots
Google Dialogflow Bot
APIs & SDKs
API Reference
API Introduction
Rate Limits
API List
koreUtil Libraries
SDK Reference
SDK Introduction
SDK Security
SDK Registration
Web Socket Connect and RTM
Installing the BotKit SDK
Using the BotKit SDK
SDK Events
SDK Functions
SDK Tutorials
BotKit - Blue Prism
BotKit - Flight Search Sample VA
BotKit - Agent Transfer
Widget SDK Tutorial
Web SDK Tutorial
ADMINISTRATION
Introduction to Admin Console
Administration Dashboard
User Management
Add Users
Manage Groups
Manage Roles
Data Tables and Views
Assistant Management
Enrollment
Invite Users
Send Bulk Invites
Import User Data
Synchronize Users from AD
Security & Control
Using Single-Sign On (SSO)
Two-Factor Authentication (2FA)
Security Settings
Cloud Connector
Analytics
Billing
  1. Home
  2. Docs
  3. Virtual Assistants
  4. SDKs
  5. BotKit SDK Tutorial – Flight Search Sample Bot

BotKit SDK Tutorial – Flight Search Sample Bot

This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai BotKit SDK, which is a collection of libraries that you can use for more control of the messages and webhook events in Kore.ai assistants for your web service. For this tutorial, you will use the sample Flight Search Assistant that you can install, generate authentication tokens, and then test using ngrok as a test callback server.

Prerequisites

To complete this tutorial, you will have to setup and configure the following prerequisites:

  • Install and run ngrok as your test callback server. The test callback server application, ngrok, is used to simulate your callback server application.
  • Install node.js on your computer (version 10 or above) – The BotKit SDK requires node.js to communicate between your server and the Kore.ai XO Platform.

Installing and running ngrok

To download the test callback server application, click https://ngrok.com/download, and then download and install the ngrok file for your operating system.

In a Terminal Window, start ngrok to monitor port 8003 using the following command:

ngrok http 8003

Copy the https Forwarding URL as shown in the previous illustration, for example, https://1b47f1d2.ngrok.io. Leave the terminal window open and ngrok running.

Installing node.js

The BotKit SDK requires node.js (version 10 or above) to run on the same server where the SDK is installed. Go to https://nodejs.org/en/download/, and then select your OS as a .pkg file type for Mac, and .msi file type for Windows.

In a Terminal window, run the node -v command to verify installation and version, for example, v6.10.2 as shown in the following illustration.

Installing and Configuring Your Assistant

With the prerequisites installed and running, you are ready to install the Flight Search Sample assistant. In this section, you will:

  • Install the Flight Search assistant
  • Create an App Registration
  • Generate Security Credentials
  • Install and Configure the BotKit SDK – config.json and FindAFlight.js files

Installing the Flight Search Assistant

Kore.ai provides ready to use sample assistants that you can install into your instance of XO Platform. For this tutorial, you will need to install the Flight Search assistant.

To install the Flight Search assistant:

  1. Log on to XO Platform, and then click New Bot > Start from the Store.
  2. Find the Flight Search assistant and install it. 

Registering Your App and Generating Client Credentials

To register your BotKit SDK with the Kore.ai XO Platform, you will need to create an app registration, and then generate security credentials used to securely communicate between the SDK installed on your server platform and the Kore.ai XO Platform.

Creating an App Registration

  1. In the XO Platform, go to Deploy > Integrations > BotKit.
  2. Next to the App name drop-down list, click Add.
  3. Enter a name for the app and then click Next.
  4. The Client ID and Client Secret details appear. Click Done.
  5. In the Callback URL field, enter the URL for your application that you copied from the Forwarding URL from the ngrok application that you installed and ran as part of the prerequisites, for example,  https://1b47f1d2.ngrok.io.
    Note: Each running instance of ngrok will generate a session unique URL. You will need to update the Callback URL field if you stop and restart ngrok.
  6. In the Events section, select OnHookNode – An event is triggered when a Webhook node is encountered in the dialog task flow.
  7. Click Save. The Successfully subscribed message is displayed.

To configure the BotKit SDK settings, you will need to:

  • Copy the Client ID, for example, cs-6e5eb411-e592-50d9-9ba2-ccc748d4f719.
  • View, and then copy the Client Secret, for example, dTTmuTOgs8SOCwF/tFizouE0EPy28fXojOJWedOEF6s=.

Publishing the Assistant

A developer can use any installed assistant immediately for testing as it is available to the owner on save. If you only want to run and test this assistant for this tutorial, you can skip to the next section, Installing and Configuring the BotKit SDK.

To enable the assistant for other users, you must publish it so the Admin can approve and deploy the assistant for users. For more information, see Publishing Your Assistant.

After you publish an assistant in the XO Platform, an Admin must complete one of the following deployments in the Admin Console depending on whether your assistant’s Target Audience is set to Enterprise Users (managed users) or General Public (unmanaged users):

  • For Enterprise Users
    1. In the Admin Console, in the Bots Management module, on the Enterprise Bots page, click the Ellipses icon for the Agent Transfer bot that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. Expand the Bot Tasks field to view the available and deployed tasks.
    3. Select all tasks of the bot and then click Confirm.
    4. In the Manage bot tasks dialog, click Confirm. The Bot status changed successfully message is displayed.
    5. On the Enterprise Bots page, click the Ellipses icon for the Flight Search assistant that you want to assign enterprise users to, and then click Bot & task assignments. The Bot & task assignments dialog is displayed.
    6. Assign the assistant to the selected users in the enterprise.
  • For General Public Users
    1. In the Admin Console, in the Bots Management module, on the Consumer Bots page, click the Ellipses icon for the Agent Transfer bot that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. Expand the Bot Tasks field to view the available and deployed tasks.
    3. Select all tasks of the assistant and then click Confirm. The Bot status changed successfully message is displayed.

Installing and Configuring the BotKit SDK

You will need to download and then uncompress the Kore.ai BotKit SDK from https://github.com/Koredotcom/BotKit. Be sure to download the latest version that contains the LiveChat.js files.

Editing config.json

In your BotKit SDK folder, you will need to edit the config.json file that contains the connection information to your callback server. For this tutorial, you are using ngrok, along with the security credentials generated when you created the app registration for the Flight Search assistant, and adding a new line to config.json file that contains the license key for your LiveChat agent application.

Modify the default config.json file for the following parameters as follows:

  • url – Add this parameter with the Forwarding URL field from ngrok
  • apikey – Update parameter using Client Secret
  • appId – Update parameter using Client ID
{
"server": {
"port": 8003
},
"app": {
"apiPrefix" : "",
"url": "< ngrok Forwarding URL >"
},
"credentials": {
"apikey": "< Client Secret from XO Platform >",
"appId": "< Client ID from XO Platform >"
},
"redis": {
"options": {
"host": "localhost",
"port": 6379
},
"available": false
},
"examples" : {
"mockServicesHost" : "http://localhost:8004"
}
}

The following code is an example of a fully defined sample config.json file:

{
"server": {
"port": 8003
},
"app": {
"apiPrefix" : "",
"url": "https://1b47f1d2.ngrok.io"
},
"credentials": {
"apikey": "dTTmuTOgs8SOCwXXXXXXXXE0EPy28fXojOJWedOEF6s=",
"appId": "cs-6e5eb411-XXXX-XXXX-9ba2-ccc748d4f719"
},
"redis": {
"options": {
"host": "localhost",
"port": 6379
},
"available": false
},
"examples" : {
"mockServicesHost" : "http://localhost:8004"
}
}

FindAFlight.js

The FindAFlight.js file in the BotKit SDK contains the JavaScript that handles the webhook call for flight information. For this tutorial, you will configure the webhook settings with the following information:

In the XO Platform, select the Flight Search assistant, and then on the Settings -> Config Settings section, select the General Settings section. The General Settings page is displayed. Copy the:

  • Bot Name – The name of the assistant on the XO Platform, for example, Flight Search Sample Tutorial.
  • Bot ID – The XO Platform system has a unique ID for the assistant, for example, st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5.

In the FindAFlight.js file, update and save the following case-sensitive variables with the settings from your assistant’s instance:

var botId = “< Bot ID >”;

var botName = “< Bot Name >“;

For example:

var botId = "st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5";
var botName = "Flight Search Sample Tutorial";

Starting the BotKit SDK Application

To start using the Flight Search assistant using the BotKit SDK, node.js must be installed and ngrok running listening on port 8003.

To start BotKit SDK

In a Terminal window, navigate to your BotKit SDK folder, and then enter the following command:

node app.js

When node.js is running, you should get the following response:

app listening at http://:::8003

Testing the BotKit SDK Bot

To test your assistant, you need the following:

  • ngrok running – Command = ngrok http 8003
  • node.js running – Command = node app.js
  • XO Platform – Start Talk to Bot by clicking the following icon on the bottom right corner of any XO Platform page:

After the Flight Search Sample dialog is started, messages are exchanged between the third-party webhook as a web service and the BotKit SDK.

Next Steps

To use the Kore.ai assistant in your application, you would need to configure the BotKit SDK and register your application with CallBack URL to point to your company application server instead of ngrok. And of course, to share the assistant with other users, the Enterprise Admin for your company would need to approve and deploy the assistant to those users after you publish.

BotKit SDK Tutorial – Flight Search Sample Bot

This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai BotKit SDK, which is a collection of libraries that you can use for more control of the messages and webhook events in Kore.ai assistants for your web service. For this tutorial, you will use the sample Flight Search Assistant that you can install, generate authentication tokens, and then test using ngrok as a test callback server.

Prerequisites

To complete this tutorial, you will have to setup and configure the following prerequisites:

  • Install and run ngrok as your test callback server. The test callback server application, ngrok, is used to simulate your callback server application.
  • Install node.js on your computer (version 10 or above) – The BotKit SDK requires node.js to communicate between your server and the Kore.ai XO Platform.

Installing and running ngrok

To download the test callback server application, click https://ngrok.com/download, and then download and install the ngrok file for your operating system.

In a Terminal Window, start ngrok to monitor port 8003 using the following command:

ngrok http 8003

Copy the https Forwarding URL as shown in the previous illustration, for example, https://1b47f1d2.ngrok.io. Leave the terminal window open and ngrok running.

Installing node.js

The BotKit SDK requires node.js (version 10 or above) to run on the same server where the SDK is installed. Go to https://nodejs.org/en/download/, and then select your OS as a .pkg file type for Mac, and .msi file type for Windows.

In a Terminal window, run the node -v command to verify installation and version, for example, v6.10.2 as shown in the following illustration.

Installing and Configuring Your Assistant

With the prerequisites installed and running, you are ready to install the Flight Search Sample assistant. In this section, you will:

  • Install the Flight Search assistant
  • Create an App Registration
  • Generate Security Credentials
  • Install and Configure the BotKit SDK – config.json and FindAFlight.js files

Installing the Flight Search Assistant

Kore.ai provides ready to use sample assistants that you can install into your instance of XO Platform. For this tutorial, you will need to install the Flight Search assistant.

To install the Flight Search assistant:

  1. Log on to XO Platform, and then click New Bot > Start from the Store.
  2. Find the Flight Search assistant and install it. 

Registering Your App and Generating Client Credentials

To register your BotKit SDK with the Kore.ai XO Platform, you will need to create an app registration, and then generate security credentials used to securely communicate between the SDK installed on your server platform and the Kore.ai XO Platform.

Creating an App Registration

  1. In the XO Platform, go to Deploy > Integrations > BotKit.
  2. Next to the App name drop-down list, click Add.
  3. Enter a name for the app and then click Next.
  4. The Client ID and Client Secret details appear. Click Done.
  5. In the Callback URL field, enter the URL for your application that you copied from the Forwarding URL from the ngrok application that you installed and ran as part of the prerequisites, for example,  https://1b47f1d2.ngrok.io.
    Note: Each running instance of ngrok will generate a session unique URL. You will need to update the Callback URL field if you stop and restart ngrok.
  6. In the Events section, select OnHookNode – An event is triggered when a Webhook node is encountered in the dialog task flow.
  7. Click Save. The Successfully subscribed message is displayed.

To configure the BotKit SDK settings, you will need to:

  • Copy the Client ID, for example, cs-6e5eb411-e592-50d9-9ba2-ccc748d4f719.
  • View, and then copy the Client Secret, for example, dTTmuTOgs8SOCwF/tFizouE0EPy28fXojOJWedOEF6s=.

Publishing the Assistant

A developer can use any installed assistant immediately for testing as it is available to the owner on save. If you only want to run and test this assistant for this tutorial, you can skip to the next section, Installing and Configuring the BotKit SDK.

To enable the assistant for other users, you must publish it so the Admin can approve and deploy the assistant for users. For more information, see Publishing Your Assistant.

After you publish an assistant in the XO Platform, an Admin must complete one of the following deployments in the Admin Console depending on whether your assistant’s Target Audience is set to Enterprise Users (managed users) or General Public (unmanaged users):

  • For Enterprise Users
    1. In the Admin Console, in the Bots Management module, on the Enterprise Bots page, click the Ellipses icon for the Agent Transfer bot that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. Expand the Bot Tasks field to view the available and deployed tasks.
    3. Select all tasks of the bot and then click Confirm.
    4. In the Manage bot tasks dialog, click Confirm. The Bot status changed successfully message is displayed.
    5. On the Enterprise Bots page, click the Ellipses icon for the Flight Search assistant that you want to assign enterprise users to, and then click Bot & task assignments. The Bot & task assignments dialog is displayed.
    6. Assign the assistant to the selected users in the enterprise.
  • For General Public Users
    1. In the Admin Console, in the Bots Management module, on the Consumer Bots page, click the Ellipses icon for the Agent Transfer bot that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. Expand the Bot Tasks field to view the available and deployed tasks.
    3. Select all tasks of the assistant and then click Confirm. The Bot status changed successfully message is displayed.

Installing and Configuring the BotKit SDK

You will need to download and then uncompress the Kore.ai BotKit SDK from https://github.com/Koredotcom/BotKit. Be sure to download the latest version that contains the LiveChat.js files.

Editing config.json

In your BotKit SDK folder, you will need to edit the config.json file that contains the connection information to your callback server. For this tutorial, you are using ngrok, along with the security credentials generated when you created the app registration for the Flight Search assistant, and adding a new line to config.json file that contains the license key for your LiveChat agent application.

Modify the default config.json file for the following parameters as follows:

  • url – Add this parameter with the Forwarding URL field from ngrok
  • apikey – Update parameter using Client Secret
  • appId – Update parameter using Client ID
{
"server": {
"port": 8003
},
"app": {
"apiPrefix" : "",
"url": "< ngrok Forwarding URL >"
},
"credentials": {
"apikey": "< Client Secret from XO Platform >",
"appId": "< Client ID from XO Platform >"
},
"redis": {
"options": {
"host": "localhost",
"port": 6379
},
"available": false
},
"examples" : {
"mockServicesHost" : "http://localhost:8004"
}
}

The following code is an example of a fully defined sample config.json file:

{
"server": {
"port": 8003
},
"app": {
"apiPrefix" : "",
"url": "https://1b47f1d2.ngrok.io"
},
"credentials": {
"apikey": "dTTmuTOgs8SOCwXXXXXXXXE0EPy28fXojOJWedOEF6s=",
"appId": "cs-6e5eb411-XXXX-XXXX-9ba2-ccc748d4f719"
},
"redis": {
"options": {
"host": "localhost",
"port": 6379
},
"available": false
},
"examples" : {
"mockServicesHost" : "http://localhost:8004"
}
}

FindAFlight.js

The FindAFlight.js file in the BotKit SDK contains the JavaScript that handles the webhook call for flight information. For this tutorial, you will configure the webhook settings with the following information:

In the XO Platform, select the Flight Search assistant, and then on the Settings -> Config Settings section, select the General Settings section. The General Settings page is displayed. Copy the:

  • Bot Name – The name of the assistant on the XO Platform, for example, Flight Search Sample Tutorial.
  • Bot ID – The XO Platform system has a unique ID for the assistant, for example, st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5.

In the FindAFlight.js file, update and save the following case-sensitive variables with the settings from your assistant’s instance:

var botId = “< Bot ID >”;

var botName = “< Bot Name >“;

For example:

var botId = "st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5";
var botName = "Flight Search Sample Tutorial";

Starting the BotKit SDK Application

To start using the Flight Search assistant using the BotKit SDK, node.js must be installed and ngrok running listening on port 8003.

To start BotKit SDK

In a Terminal window, navigate to your BotKit SDK folder, and then enter the following command:

node app.js

When node.js is running, you should get the following response:

app listening at http://:::8003

Testing the BotKit SDK Bot

To test your assistant, you need the following:

  • ngrok running – Command = ngrok http 8003
  • node.js running – Command = node app.js
  • XO Platform – Start Talk to Bot by clicking the following icon on the bottom right corner of any XO Platform page:

After the Flight Search Sample dialog is started, messages are exchanged between the third-party webhook as a web service and the BotKit SDK.

Next Steps

To use the Kore.ai assistant in your application, you would need to configure the BotKit SDK and register your application with CallBack URL to point to your company application server instead of ngrok. And of course, to share the assistant with other users, the Enterprise Admin for your company would need to approve and deploy the assistant to those users after you publish.

Menu