简体   繁体   中英

How to map a Watson Assistant conversation to a user of my application?

I integrated a Watson Assistant to my Website. To access the assistant, a user needs to log in. Now in my frontend, I know who my user is. When the user goes to the page with the watson assistant, I want to store some information of the conversation my user had with the chatbot. In my frontend I create the chatbot by including a provided script link.

When retrieving all Logs of the chatbot, I get all the conversations with conversation_ids and user_ids generated by IBM.

How do I map those IBM-generated ids to my application user-ids?

Can I somehow pass my application user_id to watson when opening the chatbot, so I can use Webhooks to post the conversation_id and my application user_id to the backend and save it there? Or is there another way to do that? What are best practices on how to do that?

Or do I have to start conversations in a programmatic way, like described here ?

The best way to send the user id to Watson Assistant is by using https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methods#updateuserid

You can then use pre or post message webhook to send to your backend your conversation_id and the user_id . The user_id you have set via the above method will appear in context.global.system.user_id .

More info can be found at: https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-web-chat-develop-userid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM