Facebook Messenger平台-Webhook订阅 [英] Facebook Messenger Platform - Webhook Subscription

查看:265
本文介绍了Facebook Messenger平台-Webhook订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照步骤设置了Facebook Messenger平台.验证GET Web挂钩请求以及订阅都可以正常工作,但是当我提交聊天时,我会不断收到以下开发者警报:

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:

诺拉, 我们注意到,您对回调URL https://{domain}/v1/webhook的Webhooks订阅至少已经有16分钟没有接受更新了.请验证您的回调服务器是否正常运行,以便您可以继续接收更新.如果您需要更新回调URL,请参阅 https://developers.facebook .com/docs/messenger-platform/webhook-reference#webhook_setup

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

如果您的回调URL连续8个小时仍无法接受更新,我们将禁用您的订阅.要重新激活订阅,请使用相同的参数发出POST请求,然后将其重新激活.

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.

我的帖子请求通过POSTMAN处理.

My post request works through POSTMAN.

请有人可以帮助我!这真让我发疯!

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

推荐答案

取决于 Webhook事件,这些事件的回调,以及在Web Hook设置中指定的url上的更多信息.

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.

如果您已预订message_deliveries事件,则每当发送一条消息时,无论是从用户到页面还是从页面到用户,都存在带有Message Delivered json的回调,也许更多目的. Webhook参考具有Message Delivered json对象的示例,但没有有关字段含义的说明或解释.

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.

有时,我发现有时会收到未记录的Read回调.未记录的json数据如下:

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
      }}]}]}

本质上,即使您可能还没有准备好进一步处理它们,也必须对回调进行编码,以优雅地处理所有类型的json数据(包括未知数).对于尚未准备好处理或不感兴趣的对象,不返回任何HTTP状态代码204(实际上,每个回调应返回204,因为类型为void).

如果仅处理您感兴趣的那些类型的json数据,则任何意外的json数据很可能会以您的Web回调代码所编写的任何语言引发异常,并导致500服务器错误返回给Facebook.正是这个500错误导致Facebook在您的问题中提出投诉.

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.

这篇关于Facebook Messenger平台-Webhook订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆