Bot state service
The key to good bot design is to do the following:
- Make the web service stateless so that it can be scaled
- Make it track the context of a conversation
Since all bots have these requirements, the Bot Framework has a service for storing bot state. This lets your bot track things such as what was the last question I asked them?
In our case, we want to save the contextId
of the LUIS to exchange the missed information to the LUIS app from our bot.
To do that, first we need to create BotStateClient
.
Creating a state client
The default state client is stored in a central service. For some channel IDs, you may want to use a state API hosted in the channel itself (for example, with the emulator channel) so that the state can be stored in a compliant store that the channel supplies.
We have provided a helper method on the activity
object, which makes it easy to get an appropriate StateClient
for a given message:
StateClient stateClient = activity.GetStateClient();
After getting the state...