0

I have a HeroCard carousel with multiple cards and buttons. These buttons correctly route if tapped immediately after the carousel is shown. However, if they are tapped at a later stage in the dialogue, the routing does not work.

How can I get buttons to correctly route the dialogue if they are tapped out of turn (i.e. tapped at some time other than immediately after the carousel is show)?

Charlie Morris
  • 476
  • 7
  • 14

1 Answers1

0

I figured it out. In version 3.1 of Bot Builder, we have the ability to listen for matches to phrases using Regex - see IntentDialog. Using this, anywhere in your dialog flow a user can type a certain phase out of context (like 'help') and can be redirected to that route.

We can use the same method when a button is tapped. The important thing to note is that the message that is returned when a button is tapped is NOT the string seen by the user. Instead, it is the route that the button is hoping to direct to.

Therefore, you can use Regex to listen for the route, and then redirect to that route. For example:

var intents = new builder.IntentDialog();
bot.dialog('/', intents);

intents.matches(/^theRouteYourButtonIsDirectingTo\//i, [
    function (session) {

        // Whatever you want to return

    },
]);
Charlie Morris
  • 476
  • 7
  • 14