This API retrieves the conversation sessions created. This API is available in BT and BAC app scopes.
To use this API, app needs the Bot Builder API scope of Bot sessions.
OR the Admin API Scope of Bot sessions under Bot Analytics.
POST https://{{host}}/api/public/stream/{{BotID}}/getSessions
and https://{{host}}/api/public/getSessions
for Bot Admin Console
Parameters
Parameter | Description |
---|---|
userId (optional) | The ID of the user whose conversation history to access. Can be user email id or enterprise assigned unique id. |
skip/offset (optional) | The number of messages to be skipped. |
limit (optional) | The number of messages to be shown on each page. |
dateFrom (optional) | Takes the date format yyyy-mm-dd (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 dataTo. |
dateTo (optional) | Takes the date format yyyy-mm-dd (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. |
tags (optional) | Meta tags to filter the conversations. |
Note: The duration between dateTo and dateFrom should be less than 7 days, else an error will be thrown.
Authorization
Invoke the API with JWT in the header with the following syntax:
auth: {{JWT}}
Response content type
application/JSON
Sample Payload
{ userId : u-xxxx-xxxxx-xxxx, skip : 0, limit : 100, dateFrom : "2019-04-01" (or) "2019-04-01T13:25:58.515Z", dateTo : "2019-04-01" (or) "2019-04-01T13:25:58.515Z", tags : { and : [ { "name" : "tagname", "values" : ["tagvalue1","tagvalue2"], "type" : "tagtype" // user/session }, { "name" : "tagname", "values" : ["tagvalue1","tagvalue2"], "type" : "tagtype" // user/session } ] }
Sample Response
{ "total": 2, "moreAvailable": false, "sessions": [ { "sessionId": "5cbxxx", "botId": "st-xx-xxx-xxx-xxx-fd3576329741", "channel": "rtm", "userId": "u-xxx-xxx-xxx-xxx-01ae7156fbd8", "start_time": "2019-04-23T10:25:34.075Z", "end_time": "2019-04-23T10:52:10.638Z", "session_lang": "en" }, { "sessionId": "5ccxxxxx", "botId": "st-xxx-xxx-xxx-xxx-fd3576329741", "channel": "rtm", "userId": "u-xxx-xxx-xxx-xxx-01ae7156fbd8", "start_time": "2019-04-24T12:27:59.929Z", "end_time": "2019-04-24T12:28:09.472Z", "session_lang": ["en"], "tags": { "userTags": [ { "value": "+919346804623", "name": "RCSID" } ], "sessionTags": [] } } ] }