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
Working with User Intent Node
Working with the Dialog Node
Working with Entity Node
Supported Entity Types
Working with Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Working with Message Nodes
Working with the Confirmation Nodes
Working with Service Node
Implementing Custom Authentication
Enabling 2-way SSL for Service nodes
Working with Script Node
Working with Agent Transfer Node
Working with WebHook Node
Defining Connections & Transitions
Managing Dialogs
Prompt Editor
Action & Information Task
Working with Action Tasks
Working with Information Tasks
Establishing Flows
Alert Tasks
Working with Alert Tasks
Managing Ignore Words and Field Memory
Knowledge Tasks
Knowledge Ontology
Building Knowledge Graph
Importing and Exporting Bot Ontology
Knowledge Extraction
Natural Language
Machine Learning
ML Model
Fundamental Meaning
Knowledge Graph Training
Ranking and Resolver
NLP Detection
NLP Settings and Guidelines
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
Talking to Bot
Utterance Testing
Batch Testing
Recording Conversations
Publishing your Bot
Analyzing your Bot
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
Universal Bots
Enabling Languages
Smart Bots
Sample Bots
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
SDK Overview
SDK Security
SDK App Registration Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Web Socket Connect & RTM
Using the BotKit SDK
Installing the BotKit SDK
BotKit SDK Configuration
Events for the BotKit SDK
Functions for 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
Sending Bulk Invites to Enroll Users
Importing Users and User Data
Synchronizing Users from Active Directory
Security & Compliance
Using Single Sign-On
Cloud Connector
Bot Store
Creating a Bot Account
Adding a Bot
Choosing a Channel for a Bot
Interacting with a Bot
Setting Up Web Service Alerts
Setting Up RSS Alerts
Setting Up the Webhook Bot
Custom Bots
Bots for your Customers FAQs
Bots for your Workforce FAQs
Adding Bots
Contacting Support
Setting Up Filters
Bot Store Settings
How Tos
Context Switching
Using Traits
Live Agent Transfer
Schedule a Smart Alert
Configure Agent Transfer
  1. Home
  2. Docs
  3. Bots
  4. SDKs
  5. Web Socket Connect & RTM

Web Socket Connect & RTM SDK libraries use the web socket channel to communicate with Bots Platform. To initialize a web socket session, the SDKs use the following Bots Platform endpoints. When using the Bots Platform SDKs, only the JWT token must be generated and passed to the client SDK.

Initializing a Web Socket Session

This section describes how the SDKs initialize a web socket session and is for reference only.


The client app is registered and Client ID and Secret Key are generated in the Bot Builder tool.


The JWT is generated at server side using client app credentials and user information. The JWT is passed to the client app.

Step 2:

The client app exchanges the JWT token for the accessToken on the Bots Platform using the following Bots Platform endpoint. This section describes how to format the request to post a message in a chat with the /api/1.1/oAuth/token/jwtgrant endpoint based on the following JSON syntax.


    "assertion": “{{JWT Token}}”,
    "botInfo": {
        "chatBot": "{{Bot Name}}",
        "taskBotId": "st-f74a3430-3b19-55a3-be41-1ab1a35c4685"

Sample cURL

curl '' -H 'content-type: application/json'  --data-binary '{"assertion":"{JWT Token}}","botInfo":{"chatBot":"{{Bot Name}}","taskBotId":"st-f74a3430-3b19-55a3-be41-1ab1a35c4685"}}


The follow sample JSON response shows the accessToken and user associated with that token.

   "authorization": {
	"accessToken": "ZdV2OL_UZ_MvHog-rs8k9KJFNWBICvquSc3jpeaRDE_-",
                 // access token to user at /api/rtm
	"token_type": "bearer",
	"expiresDate": "2019-06-28T06:52:23.160Z",
                //expiry date for access token
	"issuedDate": "2019-02-28T06:52:23.160Z" 
               //access token issuedDate
   "userInfo": {
	"userId": "u-4f6c68e0-551a-5dd9-a33a-1af3dc9cadcc", 
                 // user id which is unique for the user and can be used at bot messages api
	"accountId": "5c66514d09ab3565deb2e30a", 
                 // account id in which the user is present
	"orgId": "o-88aad7f1-0d32-5765-93d7-f40c80402114",
                // organization id of the user
	"identity": "cs-5b08ed1e-5fa7-5aaa-9c21-28bf8c90b739/", 
                //identity of user from the channel perspective
	"enrollType": "free", 
                //Enrollment type (Free/ Paid etc)
	"managedBy": "5c66514d09ab3565deb2e30a", 
                //(The account id)
	"fName": "", 
                //first name of the user
                // (fetched if the user is registered on the platform)
	"lName": "" 
                //last name of the user
                // (fetched if the user is registered on the platform)

Step 3:

The client app acquires the web socket URL using the following endpoint. This section describes how to format the request to get the web socket URL with the /api/1.1/rtm/start endpoint based on the following JSON syntax.

Note: This URL is short lived and expires in 30 seconds. You must ensure it is used to connect before expiration.


    "botInfo": {
        "chatBot": "Twitter",
        "taskBotId": "st-f74a3430-3b19-55a3-be41-1ab1a35c4685"

The accessToken is passed in the bearer parameter in the Authorization header.

Sample cURL

curl '' -H 'content-type: application/json' -H 'Authorization: bearer {{accessToken}}' --data-binary '{"botInfo":{"chatBot":"{{Bot Name}}","taskBotId":"st-f74a3430-3b19-55a3-be41-1ab1a35c4685"}'


The following sample JSON response shows the web socket URL.


RTM Events Reference

The following real-time events can be exchanged between the client app and the Bots Platform

RTM Client Events

This section describes the RTM Client Event JSON responses sent to the Bots Platform from the client app over a web socket. Event Type: /bot.message Description: Triggered when a user posts a message. The following payload is used to send a user-typed message to the Bots Platform.

    "clientMessageId": 1466692440896,
    "message": {
        "body": "Here is the message.",
        "attachments": [

    "resourceid": "/bot.message",
    "botInfo": {
        "chatBot": "CNN",
        "taskBotId": "st-8aaf0939-c34a-5976-8e2e-5c91e685b2ce"
    "id": 1466692440896

RTM Server Events

This section describes the RTM Server Event JSON responses sent to the client app over a web socket.

Event Type: ack

Description: An acknowledgment sent whenever an event is received from the client app. The following payload is used to acknowledge an event from the client app.

    "ok": true,
    "replyto": 1466692440896,
    "message": "delivered",
    "type": "ack"

Event Type: bot_response

Description: An acknowledgment sent whenever a message is processed from the client app. The following payload is sent when a message from the client app is processed.

    "type": "bot_response",
    "from": "bot",
    "message": [
            "type": "text",
            "cInfo": {
                "body": " Hi.  "
    "botInfo": {
        "chatBot": "CNN",
        "taskBotId": "st-8aaf0939-c34a-5976-8e2e-5c91e685b2ce"
    "createdOn": "2016-06-23T14:34:00.025Z",
    "icon": ""

Event Type: user_message

Description: Sent to the client app when a user enters and sends a message to the server from another simultaneous session. The following sample payload is sent to the client app.

    "botInfo": {
        "chatBot": "CNN",
        "taskBotId": "st-8aaf0939-c34a-5976-8e2e-5c91e685b2ce"
    "from": "self",
    "message": {
        "body": "how are you doing ",
        "attachments": []
    "id": 1466692871803,
    "type": "user_message"

Next Steps

The Bots Platform API endpoints and RTM events can be used with your client app or Bot SDKs. For more information, see the Bots SDK.