Are you using a standard waterfall methodology in your dialog? For example, the following code is pulled from a demo I built (written in TypeScript):
bot.dialog("location", [
(sess, args, next) => {
builder.Prompts.choice(sess, "We are showing multiple results. Please choose one:", getEntities(builder, args));
},
(sess, results) => {
sess.send(new builder.Message(sess).addAttachment(dialogs.createHeroCard(sess, parser.findExact("title", results.response.entity))));
}
]).triggerAction({
matches: "location"
});
In this example, the intent in LUIS is labeled "location", so the triggerAction
matches against that. The dialog has two functions. The first is called when LUIS returns, and it displays a choice dialog with multiple options. When the user chooses one of those options, the result ends up in the second function. So this encompasses two questions. First, the user asks where a particular speaking engagement is being held, and the bot returns a few items that match the intent (maybe there are three presentations on "bots" at a conference). It displays a choice dialog with the elements, and the user's choice pings back to the dialog (but in the second function), and sends a hero card of the presentation chosen.
In the first instance, the bot uses builder.Prompts.choice()
to ask for the choice information, and the second response uses session.send()
to display the result.
In your example, you could use builder.Prompts.text()
to ask for the user's location, and upon receiving the response (available in the second function of the waterfall as results.response
, if your function parameters are session
and results
), you'd parse that data, and then use session.send()
to display the results.
So if this were translated to your example, you could probably do something like:
bot.dialog("weather", [
(sess, args, next) => {
builder.Prompts.text(sess, "What location do you want weather for?");
},
(sess, results) => {
sess.send("Here's the weather!");
}
]).triggerAction({
matches: "weather"
});
context.PostAsync(...)
method? – Nicolas Rsession.send
? docs.microsoft.com/en-us/bot-framework/nodejs/… – Nicolas R