Reputation: 6013
I'm a bit confused about something. We are building a bot with Microsoft Bot Framework (v3 -- I know, I know, it's old, but that's what they want us to do) and at startup we offer the user th choice of two paths to follow, using buttons. It works fine, but the buttons remain on the screen after the user has clicked, as is normal. Should we attempt to handle a user click in the buttons after we have passed from their actual point of use? That is, let's say we've passed through all our waterfalls and are back at the root dialog? How we detect these clicks and intercept them and give suitable feedback (e.g. "That's not a valid choice"?).
At present, it seems there is some routing going on before the user click even gets to our root dialog --
> ChatConnector: message received. UniversalBot("*") routing <null> from
> "emulator" Library("BotBuilder").findRoutes() explanation:
> ActiveDialog(0.1) ...BotBuilder:prompt-text - WARN: Prompt - no
> intent handler found for null ...BotBuilder:prompt-text -
> Session.send() ...BotBuilder:prompt-text - Session.sendBatch() sending
> 1 message(s)
A generic "I didn't understand. Please try again." reply is sent automatically, which seems to come from botbuilder/systemResources.js
. Is this, then, the correct and expect behaviour?
I'm a bit confused, as I thought the message would always get to the root dialog and we would have a chance to evaluate it there. I've put a breakpoint in the root dialog, but it never reaches it when I click on an 'already used' button.
Thanks for any insights!
Upvotes: 1
Views: 77
Reputation: 441
I've faced a similar scenario. I have several forms as adaptive cards and also a carousel of hero cards. What I do is make sure some of the data returned on buttons clicks (or taps) is unique for every form. Then when I'm expecting a form I check if it's the right one, otherwise anything else (including messages with no luis intents) is rejected and I ask the user to answer the current question or cancel while looping back a step.
So for example, in the data for this button
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"x": 13
}
}
...
]
I would add "form" or maybe "dialog" with unique values that you can check for when you expect a specific form/card. In other places where I just expect text then I just ignore forms and re-ask the question.
I'm not how it works for NodeJs but in C#, buttons (and CardActions with MessageBack/PostBack) come under Context.Activity.Value whereas text responses are in Context.Activity.Text
Upvotes: 2