Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick replies not handled correctly as postbacks #55

Open
bradleyjkemp opened this issue Nov 14, 2016 · 6 comments
Open

Quick replies not handled correctly as postbacks #55

bradleyjkemp opened this issue Nov 14, 2016 · 6 comments

Comments

@bradleyjkemp
Copy link

When the user clicks on a quick reply button this triggers a bot.on('message', .....) handler whereas this should probably trigger a bot.on('postback', ....) instead?

@eXeDK
Copy link
Collaborator

eXeDK commented Dec 25, 2016

As mentioned here: https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
and here: https://developers.facebook.com/docs/messenger-platform/webhook-reference/message
quick replies are not postbacks but messages. Which is why they trigger a message and not a postback.

@henricazottes
Copy link

Then how do you get the payload parameter ?

@andreizamfir
Copy link

@henricazottes Did you solve this?

@henricazottes
Copy link

I handled it as a normal message, still don't know what the payload is used for :/

@arsengoian
Copy link

In case someone has a similar problem.
The payload is sent back. It's just packed differently.

Message update I get from facebook on quickreply click:

...
(
    [quick_reply] => Array
        (
            [payload] => protection
        )

    [mid] => mid.$cAAGi3mdp25doLEeQS1h-wJHEVK_8
    [seq] => 104412
    [text] => Back
)
...

So, all you should do is check for a quick_reply field in your message object

@JavaidAhmad
Copy link

When a Quick Reply is tapped, a text message will be sent to your webhook Message Received Callback. The text of the message will correspond to the title of the Quick Reply. The message object will also contain a field named quick_reply containing the payload data on the Quick Reply.

so quick reply payload will be like message.quick_reply.payload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants