Manually call LUIS without making request to the API
To put you in context of what I am trying to achieve:
-
The user types 'Hello' to the bot.
-
In response, the bot shows a HeroCard with buttons, where each button has a function linked to it. Similar to this:

- Whenever the user clicks a button some of those functions should be called and some behaviour will be done. However, the user can avoid clicking on any of those buttons and try to type something by himself. That should work and that should call LuisDialog intent handling behaviour again.
How can I achieve that?
private async Task AfterUserChoseOptionInSalute(IDialogContext context, IAwaitable<IMessageActivity> result)
{
var option = await result;
string value = option.Text;
switch (value)
{
case "help":
// do sth
break;
case "contact_us":
// do sth
break;
default:
// the user typed something else
// for example: "view my credit card balance"
// I want to call my current LuisDialog again...
break;
}
}
Should I create a new LuisDialog as a child dialog and forward the message to It? Or what would be the best way? I dont wan't to call the API by hand, I want to use the SDK.
Other option I thought was calling context.Wait(MessageReceived) and then manually sending the text to the bot, simulating the behaviour of the user typing it... But I dont know how to achieve this.
Any thoughts on this?
Here are a few options:
-
Use a scorable that looks at all user input before it reaches the dialogs on the stack - here is an example: https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Samples/AlarmBot/Models/AlarmScorable.cs#L104
-
Use a root dialog to intercept the input, try to parse out button actions, and then forward to LUIS child dialog (as you suggest)
-
Override LUIS dialog's MessageReceived to intercept button actions, otherwise delegate to base class implementation.
-
Use dispatch dialog and regular expressions to intercept button actions, otherwise delegate to your LUIS model through the next ScorableGroup.
@piffarettig , Please refer to this ticket, I hope this will help you. https://github.com/Microsoft/BotBuilder/issues/1895
Thanks @virendrak that was exactly the thing I was trying to achieve. @willportnoy thanks as well for the many options!