Reputation: 73
I am using the Microsoft Bot Framework for .NET to create a simple question/answer bot, as an ASP.NET MVC WebApi, written in C#, that will be used primarily on Slack channels with multiple users.
I have created a dialog which I initiate from my message controller as per the framework documentation:
await Conversation.SendAsync(activity, () => new QuestionDialog());
The lambda expression indicates to the Bot Framework which constructor to use for a dialog. QuestionDialog implements IDialog. After a dialog is initiated the dialog class is serialized and stored in the Bot Connector cloud, saving the current question and expected answer, then deserialized whenever a new message is received in the current conversation.
I want any user to be able to answer a random question presented by the Bot regardless of which user initiated the dialog but it seems that a new QuestionDialog is created for each user interacting with the bot so only the user initiating the question can answer it.
Is there any way of creating a dialog that is tied to the conversation/channel only rather than the combination of conversation/channel and user? Does it even make sense to attempt using a dialog in this way?
Upvotes: 1
Views: 925
Reputation: 86
I guess the way I would implement this is to:
Azure Table storage is a handy service to store the states in. You can, of course, use any service you like. Just keep in mind that in-memory state storage only works for testing.
In addition, you don't have necessarily have to use dialogs for this solution at all - you can do all you need to do in the MessagesController.
Upvotes: 0