I have a Bot service and a Node JS client that uses the open-source Web chat control. My requirement is that I need to store some user information(like userId) in a browser cookie and send this information to the bot service, so that when user returns to the bot he/she doesn't have to enter user information again. Is there a way to support this requirement with the Web-chat control and Bot service?
-
1Set the Id property of the user of your webchat with the right userId, then use Event activity to send your cookie content and store it in the userData of your user – Nicolas R Feb 23 '18 at 12:47
-
Thanks! Event activities and backchannel seem to be what I was looking for! – user3740951 Feb 23 '18 at 15:04
-
You're welcome. If you are using Microsoft Webchat project you can find a demo of backchannel on its GitHub project – Nicolas R Feb 23 '18 at 15:05
1 Answers
My requirement is that I need to store some user information(like userId) in a browser cookie and send this information to the bot service, so that when user returns to the bot he/she doesn't have to enter user information again.
It seems that you’d like to store user information in cookie to remember information about the user and pass user’s specific information to bot service. To store/retrieve user information in cookie, you can create/read cookies via the document.cookie property with JavaScript in client side code.
To pass user’s specific information to bot service, as Nicolas R mentioned in comment, you can send specific event activity with user information via backchannel mechanism. You can get more information about the backchannel mechanism from these articles:

- 26,415
- 1
- 30
- 41