How to get the conversation id?

Hi, I’m learning from Rasa website - HTTP API In this link you can see that conversation_id = “default” is used, I want to know how can I get the conversation id? You will get like this - /conversations/{conversation_id}/predict How to work on this?

1 Like

Hi @Mayankgbrc! I am not exactly sure what you are trying to do, but perhaps one of these will be helpful:

If not, can you please elaborate a bit more?

Hi @tyd. I think I’m having a similar problem to @Mayankgbrc’s. Just to give a little context, in my case I’m using Rasa with Azure Bot Service (I defined the bot service’s messaging endpoint to be https://----.ngrok.io/webhooks/botframework/webhook) connected with Microsoft Teams that any user can talk to with their Microsoft Teams account. For some specific operations, the user needs to be logged in on another website but if he/she are not logged in yet, the bot sends a link for that website’s login. When the user logs in, it would be better if the bot executed the action related to the previous message automatically instead of the user needing to send the same message again.

To do this, I can send a POST request to https://----.ngrok.io/webhooks/botframework/webhook but I need the conversation_id on the request body. I used NGROK’s web interface to see my conversation_id and this method works. However, assuming the conversation_id is unique for each user, I think this won’t work with other users.

EXAMPLE:

WHAT I WANTED:

User:      give me my information
Bot:       Please login:  https://.....?redirect_uri=__MY_API__
[USER LOGS IN]
[MY API IS CALLED AND PERFORMS A POST REQUEST TO https://----.ngrok.io/webhooks/botframework/webhook TO "RESEND" THE PREVIOUS MESSAGE]
Bot:       Here is your information:   .........

WHAT I NOW HAVE:

User:      give me my information
Bot:       Please login:  https://.....
[USER LOGS IN]
User:      give me my information   ====> I WANT TO AVOID THIS REPETITION
Bot:       Here is your information:   .........

If I knew the conversation_id on the action_server, I could just pass it as a parameter on the redirect_uri to be used on my API and my problem would be solved. Is there a way to know the conversation_id on the action_server ?

Or is this an issue that I should check on Microsoft Azure Bot Service’s side ?

Hi @jamorim95. The action server can run arbitrary code, so you should be able to create your own conversation_id at the start or call any API to get the conversation_id if it is stored elsewhere and then either way store it as a slot, so that you can use it throughout your entire conversation. Does this help?

@tyd Thanks for the quick reply.

My problem is when I close Microsoft Teams after using the chat bot. If I understood Rasa and Azure Bot Service documentation correctly, since the conversation already exists, it already has a conversation_id assigned to it which means I cannot create a new one. I have to access it somehow, but so far I did not find a way to do it.

Azure Bot Service is also managed with conversation_ids. I might be getting a little confused, but if these IDs are somehow created on their side in the beginning of the conversation (when a new user adds the bot to their Microsoft Teams chat), would it mean I can’t access the conversations_ids from Rasa ?

Azure Bot Service has an API which may solve the problem. However I think I have to go through a whole list of conversations to find the one with the correct user_id (tracker.sender_id) and extract its conversation_id.

I’m still reading their documentation and API Reference and trying to connect it with Rasa’s documentation to clarify this issue and to understand how this whole process should work.

I’ll let you know if I have any progress. Thanks

Can anyone elaborate me that conversation id and session id are same or different in rasa?

2 Likes

Hi, have you found any solution to this as even i want to get the conversation id

Hope you would have got an answer to your question. If not, conversation id and session id is same only.