So as mentioned in the title I need to figure out how to handle a postback from the user tapping/clicking a button in facebook messenger. I'm aware this card can be handled with a bot builder card but there are some other elements I want to test too. Please see the following code:
bot.dialog('/', [
function (session) {
var msg = new builder.Message(session).sourceEvent({
facebook: {
notification_type: "REGULAR",
attachment: {
type: "template",
payload: {
template_type: "generic",
elements: [{
title: "Title here",
image_url: "http://docs.botframework.com/images/demo_bot_image.png",
subtitle: "Subtitle here",
buttons: [{
type: "postback",
title: "GO",
payload: "dosomething"
}]
}]
}
}
}
});
session.send(msg);
},
function(session, results){
session.send(JSON.stringify(results));
session.send(JSON.stringify(session));
}
]);
So basically once the user clicks the 'GO' button I want to action another dialog in node, the card works but I just don't know how to handle it. I thought it might work with the waterfall but the shown code didn't return anything.
Many thanks,