javascriptchatbotfacebook-messengermessengerfacebook-chatbot

Quick reply on Facebook messenger problem


i'm having problems with the quick_reply in the facebook messenger chat bot;

the problem is: i created a 2 option quick reply button but i don't know how continue the flow after the click of one of the 2 button.

here the code: https://glitch.com/edit/#!/daffodil-authorization?path=app.js:267:3

how it works?: if u tap "what is the meaning of life", 2 quick reply button will appear "42" and "chocolate", but at the click, the bot will answer you as usual (repeating what you write); how can i allow the bot to listen "42" or "chocolate" and go on with something else?


Solution

  • Quick Replies are different from Buttons in that their payload do not return as Postback messages, but instead are delivered as normal messages as if the user typed and sent the message themselves.

    It is literally just a way for the user to return a reply, quicker than typing. So your bot is treating it like a normal message, because it is sent as a normal message.

    So either your code needs to parse and catch normal incoming messages, looking for "42" or "chocolate". Or change from using a Quick Reply to an actual Postback Button, so that you can catch them returned through Postback messages instead.