Display HeroCard using luis action binding
how to create a HeroCard in the "fulfill()" of luis action binding? any examples..?
Hi @HelloJyo , Take a look at the FullfillReplyHandler @ https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/blog-LUISActionBinding/samples/bot/app.js#L38 See how to configure LAB with the option @ https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/blog-LUISActionBinding/samples/bot/app.js#L28
More information here:
- README (search for
fulfillReply) - Commit Details: https://github.com/Microsoft/BotBuilder-Samples/pull/130
Regards, -PabloC.
` fulfill : function (parameters, callback) {
utilities.FilterFunction(parameters.x, parameters.y).then(function (matches){
utilities.CreateCard(session, matches).then(function(cards){
var reply = new builder.Message(session)
.attachmentLayout(builder.AttachmentLayout.carousel)
.attachments(cards);
callback(util.format(reply));
});
});
}`
This is what I want to do.. But session won't work on the function.
Hi @HelloJyo
You should NOT create the card in the action's fulfill method. In it you should only invoke your action and pass back a result using the callback handler.
You should create the HeroCard from the optional fulfillReplyHandler when calling the bindToBotDialog method. See here for an example: https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/blog-LUISActionBinding/samples/bot/app.js#L28
In there you'll have access to the session object and the actionModel with the result.
You can then check the actionModel.intentName to verify which LUIS intent was triggered and create the card as you wish.
Regards, -PabloC.
Okay, I got it now... Thanks and regards, -Jyo