Fetches 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.
Note: This API is currently accessible only if BotKit SDK or Agent Transfer is enabled for a bot.
This API will soon be deprecated, use this API instead: Conversation History API.
Get /api/botsdk/stream/{{stream_id}}/getMessages?userId={{user_id}}&skip={{numberOfMessagesToBeSkipped}}&limit={{numberOfMessagesTobeFetched}}
Parameters
| Parameter | Description |
|---|---|
| stream_id | Bot ID. You can access it from the bot’s General Settings page. |
| user_id | The ID of the user whose conversation history to access. |
| skip | The number of messages to be skipped. |
| limit | The number of messages to be shown on each page. |
Authorization
Invoke the API with JWT in the header with the following syntax:
auth: {{JWT}}
Response content type
application/JSON
Sample Request
curl -X GET \ 'https://bots.kore.ai/api/botsdk/stream/{{stream_id}}/getMessages?userId= u-XXX-XXX' \
-H 'auth: YOUR_JWT_ACCESS_TOKEN'
Sample Response
{
"total":1,
"moreAvailable":false,
"messages":[
{
"_id":"ms-eb23XXXXX7075f28b",
"type":"outgoing",
"status":"pending",
"createdBy":"u-6dd4XXXXXXXXXf-1f75b054f6dc",
"botId":"st-db4c106XXXXXXXXX05-350518802fd6",
"orgId":"o-232b5XXXXXXXded-d8d5131aa62c",
"lmodifiedOn":"2017-09-28T13:18:04.395Z",
"createdOn":"2017-09-28T13:18:04.401Z",
"components":[
{
"_id":"cp-905c82aXXXXXXX360499c39a",
"cT":"text",
"data":{
"text":"Thanks! I now have access to your Kore Assistant account. Don’t worry, I never access your account without you asking me to do something for you."
},
"thumbnails":[
]
}
],
"channels":[
{
"to":"u-6dd4XXXXXXXXX75b054f6dc",
"type":"rtm",
"requestId":"ms-dfabXXXXXXX7704b79b21"
}
]
}
]
}
