Search code examples
c#azurelocal-storagebotframeworkchatbot

Can local storage values be retrieved using C#


I am building a web chat bot using azure bot framework developed using C# on visual studio 2019 sdk v4. My problem is i need to retrieve the logged in user's data such as username and token from local storage so that the chatbot is functional based on the logged user. Is it possible using c# if possible can someone just come up with a proper documentation. Thankz in advance.


Solution

  • You can not access local storage directly from your bot, however you could retrieve your values from local storage (JS) and pass it to the bot via the WebChat (C#).

    You could send the variables as a 'welcome event' for example, which means you have access to the variables before the user interacts with the bot. If you want to send any variables to your bot at a later moment, have a look about how to send programmatic access to post activity.

    Sample - Send welcome event

    Sample - Programmatic access to post activity