norahw
norahw

Reputation: 1

Facebook Messenger Platform - Webhook Subscription

I have followed the steps to setup the Facebook Messenger platform. The verification GET web hook request work perfectly, as does the subscribe but when I submit the chat I keep getting the follow Developer Alert:

Hi Norah, We've noticed that your Webhooks subscription for callback URL https://{domain}/v1/webhook has not been accepting updates for at least 16 minutes. Please verify that your callback server is functioning so you may continue to receive updates. If you need to update your callback URL, see https://developers.facebook.com/docs/messenger-platform/webhook-reference#webhook_setup

If your callback URL continues to fail to accept updates for 8 hours straight, we will disable your subscription. To reactivate the subscription, make a POST request with the same parameters, and it will be reactivated.

My post request works through POSTMAN.

Please can someone help me! This is driving me nuts!

Upvotes: 0

Views: 3777

Answers (2)

u936293
u936293

Reputation: 16224

Depending on what Webhook events that you have subscribed for a page, there will be callbacks for those events, and more, on the url you have specified in the Web Hook set up.

If you had subscribed to the message_deliveries event, every time a message is sent, whether from a user to your page or from your page to a user, there is a, maybe more, calllback with a Message Delivered json object. The Webhook Reference has an example of the Message Delivered json object, but no specification or explanation on what the fields mean.

Occasionally I find that an undocumented Read callback is received, sometimes. The undocumented json data for this is like:

{"object":"page",
 "entry":[
  {
    "id":"1722858134648129",
    "time":1465407550812,
    "messaging":[
    {
      "sender":{"id":"1131485883560113"},
      "recipient":{"id":"1722858134642218"},
      "timestamp":1465407550868,
      "read":
      {
        "watermark":1465407548057,
        "seq":428
      }}]}]}

Essentially, you must code your callback to handle ALL types of json data gracefully, including unknowns, even though you may not be ready to process them further. For those that you are not ready to handle or uninterested in, return nothing with Http status code 204 (in fact every callback should return 204 as the type is void).

If you handle only those types of json data you are interested in, any unexpected json data will most likely raise an exception in whatever language your web callback code is written in and result in a 500 server error returned to Facebook. It is this 500 error that is causing Facebook to make that complaint in your question.

Upvotes: 1

Matti Nannt
Matti Nannt

Reputation: 296

Do you have logs on your server for that post requests?

Facebook requires you to return status code 200 for the post request, so they know that you successfully received it. When they havent, they try it again and if that still fails after several times, they will give you this alert. Maybe facebook uses another content-type or message content than you used with postman.

Your server logs should give you more insights about that.

Upvotes: 1

Related Questions