1

I have MS bot v4 in node js and configured Facebook and directline channels. everything working fine in Facebook channel but directline channel unable to clear the dialog which is triggered from suggestion actions.

step#1: when I click suggestion action then its action processing very well.

step#2: when I type some utterance (ex: "Hi") bot executing previous dialog which is triggered in step#1.

how can I clear/stop step#1 dialog once it completed.

Please find below code snippet:

below code used to send suggestion action to user.

var msg = MessageFactory.suggestedActions(
    CardFactory.actions([
        {
            type: 'messageBack',
            title: 'title',
            value: 'XYZDialog'
        }
    ]), 'Click'
);
await stepContext.context.sendActivity(msg);  

below code onMessage event to detect the dialog

this.onMessage(async (context, next) => {
    if (context._activity.hasOwnProperty('value')) {
        this.dialog.initialDialogId = 'XYZDialog';
    }

    await this.dialog.run(context, this.dialogState);
    await next();
});

below code to run above detected dialog.

async run(turnContext, accessor) {
    const dialogSet = new DialogSet(accessor);
    dialogSet.add(this);
    const dialogContext = await dialogSet.createContext(turnContext);
    const results = await dialogContext.continueDialog();

    if (results.status === DialogTurnStatus.empty) {
        await dialogContext.beginDialog(this.id);
    }
} 

Please let me know how can I resolve this issue. Let me know if you need any additional information.

Mick
  • 2,946
  • 14
  • 19
Anil
  • 69
  • 7
  • I think its already been answered in https://stackoverflow.com/a/60613831/9599453 and you can also refer to https://stackoverflow.com/questions/57766022/how-to-disable-button-after-single-use-in-a-adaptive-card/57777087#57777087 to track button clicks using bot state – ranusharao Apr 21 '20 at 22:20

0 Answers0