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 Major 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
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
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
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
Azure OpenAI
Overview
Templates
BambooHR
Overview
Templates
Freshdesk
Overview
Templates
Freshservice
Overview
Templates
HubSpot
Overview
Templates
JIRA
Overview
Templates
Microsoft Graph
Overview
Templates
Open AI
Overview
Templates
Salesforce
Overview
Templates
ServiceNow
Overview
Templates
Stripe
Overview
Templates
Twilio
Overview
Templates
Agents
Agent Transfer Overview
Custom (BotKit)
Drift
Genesys
Intercom
NiceInContact
Salesforce
ServiceNow
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
NLP Insights
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
Plan & Usage
Overview
Usage Plans
Support Plans
Invoices
Authorization
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
API List
API Collection
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
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. API Guide
  5. Conversation History API

Conversation History API

To fetch the conversational messages between the bot and user in reverse chronological order. This API supports pagination. You can provide offset/skip and limit to get a certain number of messages at a time.

This is a newer version of the old API which will be deprecated soon. This revised API addresses the limitation of the older version on Botkit enablement or Agent Transfer.

Method GET and POST
Endpoint GET method: https://{{host}}/api/public/bot/{{BotID}}/getMessages?userId={{userID}}&skip=10&limit=10

Note: By default the GET method shows the RTM interactions. If you want to retrieve any channel interaction, you must pass the channelType parameter in the GET method. For example, to retrieve the WebHook channel interactions, enter channelType = IVR in the GET call. For the channelType parameter values, see Request Body Parameters section.
POST method https://{{host}}/api/public/bot/{{BotID}}/getMessages
and https://{{host}}/api/public/getMessages for Bot Admin Console.
Note: A POST method call can also be used to include Session-Id and MetaTags in the retrieved Conversation History.

Content Type application/json
Authorization auth: {{JWT}}

See How to generate the JWT Token.

API Scope
    • Bot Builder: Chat History

OR

  • Admin Console: Bot Analytics > Chat History

Path Parameters

Parameter Required/Optional Description
host Required Environment URL, for example, https://bots.kore.ai
BotID Optional Bot ID or Stream ID. You can access it from the General Settings page of the bot.

 

Sample Request

Sample Request for GET Method

curl -X GET \
'https://bots.kore.ai/api/public/bot/{{BotId}}/getMessages?userId=u-XXX-XXX&
channelType=ivr&dateFrom=2019-04-01&dateTo=2019-04-05' \ 
-H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}'

Sample Request for POST method

curl -X POST \
  'https://{{host}}/api/public/bot/{{botId}}/getMessages' \
  --header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
  --header 'Content-Type: application/json' \
  --data '{
    "userId"           : "u-xxxx-xxxxx-xxxx",
	"skip"             : 0,                           
	"limit"            : 100,                       
	"dateFrom"         : "2019-04-01",
	"dateTo"           : "2019-04-01",
	"channelType"      : "rcs",
	"sessionId"        : ["5eadxxxxxxxxxxxxx","5ebxxxxxxxxxxxxxxx"],
	"tags"	         : {
		          "and"   : [
			            {
			              "name"  : "tagname",
			              "values"  : ["tagvalue1","tagvalue2"],
                                      "type"    : "tagtype"
                                     },
                                   {
                                    "name"  : "tagname",
    			            "values"  : ["tagvalue1","tagvalue2"],
                                    "type"    : "tagtype"  
                                   }
                                  ]	
                       }
           }'

Request Query Parameters

Parameter Required/Optional Description
channelType required Channel type name for which you want to see the interactions; the default is “rtm” .

Accepted channel types are:

  • “skypeforbusiness”,
  • “msteams”,
  • “twitter”,
  • “spark”,
  • “rtm”,
  • “facebook”,
  • “slack”,
  • “skype”,
  • “kore”,
  • “email”,
  • “sms”,
  • “wfacebook”,
  • “ringcentral”,
  • “jabber”,
  • “yammer”,
  • “alexa”,
  • “twiliovoice”,
  • “telegram”,
  • “ivr”,
  • “ivrVoice”,
  • “line”,
  • “liveperson”,
  • “googleactions”,
  • “hangoutchat”,
  • “mattermost”,
  • “rcs”.

Note: In case of multi-webhook channel configuration, “ivr” gives the conversations for the first WebHook instance. For other WebHoo instance, specify theivrInstID, you can get it from the WebHook URL which is of the form: {{host_url}}/chatbot/hooks/{{BotId}}/hookInstance/{{ivrInstID}})

userId required for GET

optional for POST

The ID of the user whose conversation history to access. Can be user email id or enterprise assigned unique id.
dateFrom optional Accepts the yyyy-mm-dd date format.
(or) yyyy-mm-ddThh:mm:ss.msZ
eg:2019-04-01 (or) 2019-04-01T13:25:58.515ZIf not provided, calculated as 7 days behind dateTo.
Note: This field cannot be used in combination with msgId.
dateTo optional Accepts the yyyy-mm-dd date format.
(or) yyyy-mm-ddThh:mm:ss.msZ
eg:2019-04-01 (or) 2019-04-01 T13:26:05.598ZIf not provided, calculated as 7 days from dateFrom. If dateFrom is also not provided then set to Today.
Note: This field cannot be used in combination with msgId

Note: The duration between dateTo and dateFrom should be less than 7 days, else an error will be thrown.

 

Request Body Parameters

Parameter Required/Optional Description
skip/offset optional The number of messages to be skipped.
limit optional The number of messages to be shown on each page.
forward optional Takes string values – “true” or “false”. Specifies the direction of the messages to be retrieved.

  • If the value is “true”, then the conversation history is retrieved in the order old to the most recent one.
  • If the value is “false,” then the conversation history is retrieved in reverse order, from the most recent to the oldest message.
msgId optional A specific Message-Id if known. This would fetch the records starting from that message either forward or backward depending upon the direction (see below) requested.

In case only the specific conversation is required, set the limit to 1

Note: This field cannot be used in combination with dateFrom and dateTo.

direction optional when msgId is given
  • <0 reverse
  • =0 bidirectional
  • >0 forward

Default direction is forward.

sessionId optional A specific Session-Id if known. Refer here to obtain the session id
tags optional Meta tags to filter the conversations.

 

Sample Response

Sample response for the GET method

{
"total": 1,
"moreAvailable": false,
"icon": "https://dlnwzkim0wron.cloudfront.net/f-87c47629-7exxxxxxxx-a807ccfb1cf0.png",
"messages": [
{
"_id": "ms-9de62385-c8bd-5053-86c2-7axxxxxxxxxx72",
"channels": [
{
"to": "st-3dfe0cc0-6c34-5b46-bb15xxxxxxxcf",
"type": "ivr",
"channelDispName": "WW"
}
],
"type": "incoming",
"status": "received",
"createdBy": "u-47d826af-3a83-51f7-a049-dexxxxxx",
"lmodifiedBy": "u-47d826af-3a83-51f7-a049-dexxxxxxx",
"createdOn": "2023-03-28T11:06:38.793Z",
"lmodifiedOn": "2023-03-28T11:06:38.793Z",
"botId": "st-3dfe0cc0-6c34-5b46-bb15-bf2dxxxxxxf",
"orgId": "o-312ffdea-4dbc-56e9-abfa-1d2xxxxxxx8",
"accountId": "61f8ea4799bf74163xxxxxxx35",
"isBB": 0,
"ms": 1,
"chnl": "ivr",
"isD": 0,
"components": [
{
"_id": "cp-4b3b4800-5d5a-5179-a9dc-c09dxxxxxxx91",
"cT": "text",
"data": {
"text": "hi"
},
"thumbnails": []
}
],
"timestampValue": 1680001598803,
"__v": 0,
"lang": "en",
"sT": 1,
"sessionId": "6422ca31a7cf935ce74ec355",
"EOD": 3,
"nodeType": 3,
"tr0_I": "smalltalk_9f46b71b:3a74d188fe43591674878c8d958f0299",
"tr_pId": "dg-30c18288-694b-5e27-8744-c27fxxxxxxxe:nd-msg-4944e1d5-26b9-4cda-b219-016e57b7e905:2cxxxxxxx06a98a4b40ce6bf35adfb3b",
"cluster_id": "Others",
"resourceid": "messagestore",
"tags": {
"messageTags": [],
"userTags": [],
"sessionTags": [
{
"value": "rr",
"name": "ss"
}
]
}
}
]
}

Sample Response from POST method:

{
  "total": 1,
  "moreAvailable": false,
  "messages"  : [
                {
                  "_id": "ms-xxxxxxxxxxxxxxxxxxxx",
                  "type": "incoming",
                  "status": "sent to cs",
                  "createdBy":"u-xxxxxxxxxxxxxxxxxxx",
                  "lmodifiedBy": u-xxxxxxxxxxxxxxxxxxx",
                  "lmodifiedOn": "2019-04-10T10:21:45.103Z",
                  "channels": [
                     {
                      "type": "rcs"
                        }
                     ],
                  "botId":"st-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                  "orgId": “o-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                  "accountId": "5xxxxxxxxxxxxxxxxxxxxxxxx",
                  "isBB": 0,
                  "ms": 1,
                  "channel": "rcs",
                  "components": [
                    {
                      "_id":"cp-xxxxxxxxxxx",
                      "cT": "text",
                      "data": {
                          "text": "23"
                           },
                      "thumbnails": []
                      }
                    ],
                    "createdOn": "2019-04-10T10:21:45.106Z",
                    "timestampValue": 1554891705106,
                    "__v": 0,
                    "sessionId": "5cadbefc6a81a71559f6bece"
               }
             ]
 }

 

Response Body Parameters

Parameter Description
total The total number of records identified as per the API request parameters. The response will include a maximum of X records. If more than X records are identified, then the ‘moreAvailable’ field in the response will have the value as ‘True’.

It is recommended to programmatically iterate the request by dynamically updating the values of the ‘skip’ and ‘limit’ parameters in the request.

moreAvailable Indicates if the API has returned all the records or if more are available, based on the pagination criteria.
True if more records are available. False if there are no more records to be retrieved.
icon The URL of the bot logo.
messages Contains complete information about the message.
messages._id The unique identifier for the message record.
messages.type The message type – incoming (user input) or outgoing (bot response).
messages.status Processing status of the message: received, queued, in progress, delivered, or pending.
messages.lmodifiedOn The last modified time for the record.
messages.createdBy The user ID of the end user who was chatting with the bot.
messages.channels The channels object provides additional information about the channel through which the conversation was initiated.
messages.channels.type Name of the channel through which the conversation is initiated. The default is ‘rtm’.
messages.channels.channelUId The end-user’s identity provided by the channel.
messages.components Additional information about the message record.
messages.components._id The unique id of the component.
messages.components.cT Type of the user input (component type): text, audio, video, image, attachment, contact, task, filelink, location, email, alert, action, timeline, meeting, error, upgrade, NLResponse, or contextUpdate.
messages.components.data The data object.
messages.components.data.text The message shown to the user or the bot, depending on the message type.
messages.components.thumbnails The thumbnails object.
messages.components.thumbnails._id The unique id of the thumbnails.
messages.components.thumbnails.width The width of the thumbnails.
messages.components.thumbnails.height The height of the thumbnails.
messages.components.thumbnails.size The size of the thumbnails.
messages.components.thumbnails.url The URL of the thumbnails.
messages.botId Bot ID or Stream ID.
messages.orgId The organization ID to which the bot belongs to.
messages.accountId The account id to which the bot belongs to.
messages.isBB Informs whether the conversation was initiated from the Bot Builder; 1 for Yes, 0 for No.
messages.isD Informs whether the conversation was initiated by a developer; 1 for Yes, 0 for No.
messages.lang The conversation’s language.
messages.ms Message source; enum[0,1,2,3]; 0-task alert, 1-text, 2-task(action), and 3-others.
messages.chnl The end user’s conversation channel.
messages.createdOn The record creation date.
messages.timestampValue The creation date converted into the timestamp format.
messages.__v The field is used for internal purposes. No specific significance.
messages.resourceid The field is used for internal purposes. No specific significance.
messages.tags Meta tags to filter the conversations.
messages.tags.messageTags Message tags object; custom tags added to the message in the conversation.
messages.tags.messageTags.value Tag’s value.
messages.tags.messageTags.name Tag’s name.
messages.tags.userTags User tags object; custom tags added to the user’s profile information.
messages.tags.userTags.value Tag’s value.
messages.tags.userTags.name Tag’s name.
messages.tags.sessionTags Session tags object; custom tags added to the conversation session.
messages.tags.sessionTags.value Tag’s value.
messages.tags.sessionTags.name Tag’s name.
Menu