I am new to Microsoft Bot Framework
.I have created a bot using Microsoft Bot Framework
. How do I create a session so that the variebles
added to the controller is individual specific. Currently the problem I am facing is whenever multiple users are chatting with the bot, the values in the variebles
are getting over written thus giving wrong values to the users.
Have you referred
https://docs.botframework.com/en-us/csharp/builder/sdkreference/stateapi.html
In my project am using simple code to store session value for a user based on his device.
StateClient sc = activity.GetStateClient();
userData.SetProperty<string>("MyDetails", < some value >);
// Save BotUserData
await sc.BotState.SetUserDataAsync(activity.ChannelId, activity.From.Id, userData);
// Get BotUserData
BotData userData = await sc.BotState.GetUserDataAsync(activity.ChannelId, activity.From.Id);
So, you can store values to individual user.