SOLVED

Skill Dialog Bots and Update Activity

Contributor

Hi,

 

In a dialog-root-bot and skill-dialog-bot implementation, if my skill-dialog-bot shows an adaptive card and the user has already acted on the presented card, I want to update the card with either a 'text' message or a card to avoid the user from interacting with the previous card again.

 

My dialog-root-bot's WaterfallDialog definition is as follows

 

.addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
	this.actStep.bind(this),
	this.finalStep.bind(this)
]));

 

In finalStep, I check for the results from the skill-dialog-bot and determine if I need to update the activity and present the next card or message.  In the following snippet, I replace the previous card with a new card

 

const details = stepContext.result;
const conversationId = details.conversationId;
const activityId = details.activityId;

const nextCard = stepContext.context.activity;
nextCard.value = null;
nextCard.text = null;
nextCard.type = ActivityTypes.Message;
nextCard.conversation.id = conversationId;
nextCard.id = activityId;
nextCard.attachments = [details.nextCard];
await stepContext.context.updateActivity(nextCard);

 

What happens now is that even though the skill-dialog-bot has ended the conversation, the line "stepContext.context.updateActivity(nextCard)" will again pass control to the skill-dialog-bot.  

 

Is there a way to prevent that?

 

Thank You

2 Replies

@voonsionglum - From the code i could see that you are using await for final step, it will update the card and return the dialog. Could you please use return instead of await functionality?

best response confirmed by voonsionglum (Contributor)
Solution

@Nikitha-MSFT updating to await for final step did not produce the desired results.  Anyway, we reviewed the dialog logic and have decided to take a different routing approach.  Thanks for your help!

www.000webhost.com