facebook-messenger: messaging_optins webhook event not working for messenger

Hi, I’m trying to get the event when the developer/tester/admin click on the messenger plugin to start chat chat these are the selected event with my app:

Selected events: messages, messaging_postbacks, messaging_optins

from these 3 events, two are working perfectly. but messaging_optins isn’t working.

https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_optins

from that link above it is mentioned:

This callback will occur when the send to Messenger plugin has been tapped, a user has accepted a message request using customer matching, or a user has opted in to receive messages via the checkbox plugin.

I’m tapping on the start chat button with different developer account. but everytime it fails to send me the webhook for this.

Can you guys please help me on that?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 40 (16 by maintainers)

Most upvoted comments

Hi all,

After change my role or change the mode to live mod. It works 😄

image

image

The initial issue was for the webhook that happens after MessengerCheckboxUserConfirmation. So that is different from what you are now seeing.

Your app needs to send that MessengerCheckboxUserConfirmation to Facebook, or else you’ll never get any other webhook related to that user.

  1. You create a unique user_ref (unique per user, per page load)
  2. You render the facebook-messenger-checkbox element on the page, with the user_ref, and other attributes filled in
  3. User is logged into FB and checks the facebook-messenger-checkbox
  4. The user clicks a button, and you fire the MessengerCheckboxUserConfirmation.
  5. Facebook (after a short while, usually seconds) sends your registered server a messaging_optins webhook, passing you the user_ref, ref, etc, as part of the webhook payload.

Do you mean this percentage is independent of which Facebook App/Page (/account?) you use?

Yes, kind of. We have multiple users on our site, and each one has a different Facebook account, and Facebook Pages through our SINGLE Facebook app.

He says messaging_optin webhook worked only once, among like a hundred trials.

Oddly enough, my own personal account and FB pages do not seem to send the messaging_optin webhooks anymore to our app server. It is not clear why Facebook is no longer sending optins that should fire due to my FB account clicking a FB Checkbox on a page, but, I’m one of the 10% of users where the messaging_optin webhooks simply does not arrive anymore. Prior to about November 2018, I did not have this issue at all, and it seemed like we received 100% of the webhooks we expected. But, we did not have our own analytics tracking setup at the time, so I cannot be certain about the percentage of “successful” webhooks then. We only recently added analytic tracking of our own that tracks when the FB Messaging Checkbox is checked, and then when we receive a webhook for the checkbox.

I hope that is somewhat helpful.

messaging_optin webhook worked only once, among like a hundred trials.

In our case, it was our fault. My colleague says it was something like a combined problem caused by ngrok and await import in React.

Thank you very much for sharing your experience @cfurrow ! I think we managed to find the cause earlier by your knowledge.

We don’t suffer from this issue #227 now, but I think we might in the future, like after we start testing with more variation of FB account. In that case, we will report about our case here, hoping that helps this issue fixed.

Does this mean messaging_optins works for most people (or Facebook App/Pages) other than us/ours Or maybe only few people use this webhook??

It does seem to work for most people. In our own testing/analytics, we see that the percentage of FB Messenger Checkbox checked vs the messaging_optin received from Facebook is over 90%. Meaning that 90% of the time, if a user checks the Facebook Messenger Checkbox and submits a form on the page, we receive a messaging_optin webhook from Facebook like we expect. The other 10% of the time something went wrong, and we are still investigating whether it’s on our side, or FB.

But, since there is that outstanding Facebook bug around the messaging_optin webhook, it could be on their side, but they have not identified the issue yet, but have added more logging on their end.