I would like to start a 'reminder dialog' when sending a proactive message to a user. The dialog is posted. but when processing the answer it goes back to the main dialog.
Currently i create my bot as followed:
const conversationState = new ConversationState(mongoStorage);
const userState = new UserState(memoryStorage);
const bot = new DialogAndWelcomeBot(conversationState, userState, logger);
// Listen for incoming activities and route them to your bot main dialog.
server.post("/api/messages", (req, res) => {
adapter.use(new GraphQLMiddleware(bot.getAuthState()));
// Route received a request to adapter for processing
adapter.processActivity(req, res, async turnContext => {
await bot.run(turnContext);
});
});
and send the pro active message like this:
await adapter.createConversation(conversationReferenceAdapted, bot.remind);
where the DialogAndWelcomeBot has the following function:
remind = async turnContext => {
const reminderDialog = new ReminderDialog(this.logger);
await reminderDialog.run(turnContext, this.dialogState);
await this.conversationState.saveChanges(turnContext, false);
await this.userState.saveChanges(turnContext, false);
};
However, the ReminderDialog gets fired correctly (with a yes and no button). But when i press any of those buttons i get:
[onTurnError]: Error: DialogContext.continue(): Can't continue dialog. A dialog with an id of 'ReminderDialog' wasn't found.
Which makes me suspect it doesn't know the ReminderDialog in the original flow (through the constructor of DialogAndWelcomeBot where the MainDialog is instantiated and run).
Any ideas on how to approach this?
from Processing answer to reminder dialog
No comments:
Post a Comment