My problem is, How can I send some data on behalf of user to the bot before user start chatting.
because different client will have different endpoint, I would like bot to get this endpoint first and save it as UserState, then use this endpoint for making API calls later.
I'm using "https://github.com/microsoft/BotFramework-WebChat" this web chat as my client side, it create the directline using the secret, is that possible i add a post activity in the html file below to send some data?
Thank you!
<!DOCTYPE html> <html> <body> <div id="webchat" role="main"></div> <script src="Scripts/Directline.js"></script> <script> window.WebChat.renderWebChat({ directLine: window.WebChat.createDirectLine({ token: 'my secret' }), locale: 'en-US', botAvatarInitials: 'Bot', userAvatarInitials: 'ME', }, document.getElementById('webchat')); </script> </body> </html>
You can add a custom middleware to Web Chat's store which can send an event containing the necessary data to the bot when the DirectLine connection is fulfilled. See the code snippets below.
Web Chat
Bot - C# SDK
For more details, take at the Send Backchannel Welcome Event Web Chat sample.
Hope this helps!