Not able to retrieve chat history using getMessages GET API

In order to get the history for Chat we have followed the documentation as given by you. (https://developer.kore.ai/docs/bots/api-guide/conversation-history-api/) :

  1. Enabled the app’s Bot Builder API scope to Chat History .

  2. Called the API from Documentation (https://bots.kore.ai/api/public/bot/st-f405da93-162e-58f2-86aa-74a2e3c11337/getMessages) with following parameters:

userId : praful_dhone@persistent.com
skip (optional): 0 or 10
limit (optional): 0 or 10
dateFrom (optional): Today or 2020-11-20
channelType (optional): kore or not specified.

In Header, passed the proper JWT Token. We are getting the 200 OK Status code with empty history.

{
“total”: 0,
“moreAvailable”: false,
“icon”: “https://dlnwzkim0wron.cloudfront.net/f-7f08c5fd-d769-5115-a89e-7bb546f6e074.png”,
“messages”: []
}

  1. We have published the Bot and tried to test it. Still not getting any history. Following are the screen shots:

Are we missing something important here?

We also have question on JWT Token. Till now, we are able to generate the JWT token in Web SDK in order to call the Bot.

How can we generate it on Platform to call the chat history?

Option 1: Are we supposed to pass this from Web SDK to Bot platform and then use it in API call of Chat History?
Option 2: Generate it on the fly on platform and call the Chat History API?

Hi @praful_dhone,

In the bot builder >> go to “API Extensions” >> Manage Apps >> New App >> create an App and you will be able to see the clientId and secret generated for the app.

Now, go to “API scopes” and select the App and the API’s that you would like to enable for this App.

image

Publish the bot and generate the JWT token using the newly created App credentials.
Use it while hitting the API and let us know if you are observing any error even after following the above.

Regards,
Yoga Ramya

Thanks Yogaramya. This is achieved now. We are sending the JWT token from WebSDK to Bot in custom data and we are using it on platform to get the history.