kinni/fb-bot-framework

Quick reply usage?

Closed this issue · 3 comments

Is it possible to use quick_replies like: bot.sendQuickReplies(userId, text, quick_replies, notificationType, cb)?

kinni commented

yes! I will push the latest version in next week.

Great Mate! Thx!

kinni commented

Just updated! You can now listen to quick reply callback and perform you task there.

Sample Code:

bot.on("message", function(userId, message){
    // bot.sendTextMessage(userId, "Echo Message:" + message);

    // Send quick replies
    var replies = [
        {
            "content_type": "text",
            "title": "Good",
            "payload": "thumbs_up"
        },
        {
            "content_type": "text",
            "title": "Bad",
            "payload": "thumbs_down"
        }
    ];
    bot.sendQuickReplies(userId, message, replies);
});

// Setup listener for quick reply messages
bot.on("quickreply", function(userId, payload){
    bot.sendTextMessage(userId, "payload:" + payload);
});