文档已更新。
中文(简体) 译文尚未完成。
英语更新时间:7月1日
中文(简体) 更新时间:6月6日

FAQ

This document provides answers to frequently asked questions.

General

使用 Facebook 登录 并向特定公共主页授予 pages_messaging 权限,即可从应用网站安装应用。授权应用将显示在高级消息功能中的公共主页设置

固定链接

可以,单个 Facebook 应用可以订阅多个主页。与 pages_messaging 权限一样,在接受应用审核后,应用即可订阅接收多个主页的 Webhook。您可以根据负载情况获取每个 Webhook 的环境。

固定链接

可以,系统允许多个应用订阅同一个公共主页。当您使用多个应用处理同一个对话时,我们建议您使用 移交协议 以处理在任何指定时间哪个智能助手拥有该对话。

固定链接

General Data Protection Regulation (GDPR)

如需阅读有关《通用数据保护条例》和 Messenger 平台的常见问题解答,请访问 Messenger 平台与《通用数据保护条例》页面。

固定链接

Entry Points

如果使用“发送到 Messenger”插件,您可以使用 data-ref 作为传递参数,发送有关点击情境的任何信息。

用户还可通过 Messenger 中的搜索功能发现您的主页。这种情况下,您不会获得传递参数,但您可以使用帐户绑定功能将对话关联到您网站上的用户帐户。

固定链接

One-time Notification API

No. Unlike subscriptions where a business can send multiple messages to people on a recurring basis, the one-time notification API limits the business to a single message per user request. If the person engages with the message, the standard messaging window will reopen.

固定链接

Yes. Pages interested in using the One-time Notification API need to apply for permission. Go to the Advanced Messaging section of your Page Settings and consent to the terms. A Page will be granted permission if the Page meets our criteria.

固定链接

Common uses of the API include various promotional and non-promotional use cases where the User explicitly requested a follow-up. Examples include:

  • Back in stock alerts
  • Collection launches
  • Concert tickets going on sale
  • Price drop alerts
  • Train tickets available for purchase
  • CSAT surveys
固定链接

Your Page is not allowed to send a notification on a topic for which the User has not agreed to receive a notification. Please see the Usage and Restrictions and Limitations sections of the One-time Notification guide for more information.

固定链接

A Page can send multiple requests however, the 24-hour policy will be applied to all the requests being sent. We also have controls in place to prevent spamming users with multiple requests.

固定链接

The 24 hour standard messaging window will open only if the user interacts with the opt-in message. The behavior is consistent with interactions with other elements in the Messenger experience.

固定链接

Once a person asks to be notified, the Page will receive a token which is equivalent to a permission to send a single message to the person. The token can be used to send a message to the person outside the 24 hour window. The token can only be used once and unused tokens will expire within 1 year of creation.

固定链接

Yes. However, while it is possible to send another notification request using an existing token, there is no clear benefit for the business to send these type of requests.

固定链接

No. The API does not return tokens available to a Page.

固定链接

No. The app does not need to specify any message tags when sending a message outside the 24-hour standard messaging window using this API.

固定链接

Send/Receive API

发生这种情况的原因有以下几个:

  • 您使用的用户编号是通过 Facebook 登录获得的。 通过 Facebook 登录获得的用户编号不能与收发消息 API 兼容。只有通过 Messenger 平台身份验证流程获得的用户编号才能用于 Messenger 平台
  • 您在使用用户编号时,使用了错误的主页访问口令。 Messenger 平台的用户编号是主页范围编号,因此与特定主页关联。如果您使用了有效的用户编号,但所使用的主页访问口令却与另一个主页关联,则调用会失败。请确保您使用的用户编号和主页访问口令均与同一主页关联。
  • 接收您所发消息的手机号码近期未经过验证。 您结合使用发送 API 和手机号码时,我们只会向近期经过验证的手机号码发送消息。即使手机号码显示为已验证,但如果近期并未经过验证,消息发送就会失败。请重新验证您的手机号码,并等待 24 小时后重试。
固定链接

Here is a workaround to use a platform test user for your messenger platform integration:

  1. From your app's Roles page, create a new test user by clicking the Add button.
  2. Toggle the Authorize Test Users for This App? option and grant permissions "page_messaging".
  3. Use the Edit Button and get an access token for this user (using v4.0). Please save this for later.
  4. Use the Edit button to login as the test user.
  5. After logging in, create a page as the test user.
  6. Use the user access token for the test user to get the page access token for this user. You can do this with the following call:
    https://graph.facebook.com/v4.0/me/accounts?access_token=[TEST_USER_ACCESS_TOKEN]
    (Documentation)
  7. Use this page access token to link your Facebook Application with your Page:
    https://graph.facebook.com/v4.0/me/subscribed_apps?method=POST&access_token=[TEST_USER_PAGE_ACCESS_TOKEN]
            
    (Documentation)
  8. After you have followed these steps you will receive RTU updates to your Test Page and be able to message your Test User from your Test Page. In addition to the above you can replace your access token with a long-lived token if they are expiring too quickly for your tests. Please follow the documentation here:
    GET /oauth/access_token?  
        grant_type=fb_exchange_token&           
        client_id={app-id}&
        client_secret={app-secret}&
        fb_exchange_token={short-lived-token} 
            
固定链接

If your business tries to send an update message that falls under one of the approved use cases in message tags, we’d recommend you to still tag it using messaging_type=MESSAGE_TAG with an appropriate message tag. That way you don’t need to keep track of whether a conversation is still within under the 24-hour window in standard messaging.

固定链接

Under the standard messaging policy apps can't send messages outside the 24-hour window. The message will fail to be sent. If a message tag is used the message can be sent outside the 24 hour period as long as is one of the supported use cases and the app is in good standing.

固定链接

不能,Messenger 平台提供的任何 API 都无法返回所有选择接收您智能助手消息的用户的 PSID 列表。

固定链接

Webhooks

接收回调需要两个步骤。第一步,确保 Webhook 设置正确 (https://developers.facebook.com/docs/messenger-platform/webhook-reference#setup)。有表示 Webhook 设置正确的指示器。

第二步,必须订阅各个主页。系统会列出所有被订阅的主页。

如果 Webhook 调用长时间失败,系统就会取消应用的订阅,且您必须重新添加 Webhook,并重新订阅主页。

固定链接

Webhook 调用的 X-Hub-Signature 标头包含一个字段,可用于验证调用是否来自 Facebook。

固定链接

您应确保 Webhook 的响应包含状态代码 200。系统可通过此响应代码判断 Webhook 成功接收。如果未返回状态代码 200,系统就会重新调用,直到成功完成。此外,如果 Webhook 长时间一直未返回状态代码 200,我们就会发送开发者提醒。

另请注意,应及时返回成功状态代码。Webhook 调用若在 20 秒内无响应,即被视为超时。在设计代码时请确保 Webhook 得到异步处理,以便能够立即返回并单独处理成功状态代码。

固定链接

There is a tool that shows recent webhook errors. If webhooks are failing to be delivered, Meta servers will unsubscribe your URL. To find the tool, go into your App dashboard > Messenger > Settings, inside the Webhooks card there is a button called Show recent errors

固定链接

See Also