常見問題

本文件提供常見問題的解答。

一般

您可以前往應用程式網站,使用 Facebook 登入 並將 pages_messaging 權限授予特定專頁,以安裝應用程式。獲授權的應用程式會出現在「進階訊息」的「專頁設定」區塊中。

可以,單一 Facebook 應用程式可以訂閱多個專頁。與 pages_messaging 權限一樣,接受應用程式審查後,應用程式即可訂閱並接收多個專頁的 Webhook。您可以根據承載情況獲取每個 Webhook 的情境。

可以,一個專頁可訂閱多個應用程式。當多個應用程式處理同一對話時,最好使用 交接通訊協定 處理哪個 BOT 在任何指定期間內掌控相關對話串。

《一般資料保護規章》(GDPR)

入口點

使用「傳送到 Messenger」附加程式時,您可以使用 data-ref 參數作為傳送參數,用來傳送任何與點擊內容有關的資訊。

用戶也可以透過在 Messenger 中搜索以發現您的專頁。在這些情況下,您就不會有傳送參數。您可以使用帳戶連結功能,將對話串連結您網站的用戶帳戶。

如果應用程式處於開發模式,只有應用程式的管理員、開發人員與測試用戶才看得到該附加程式。應用程式經過審查並通過之後,您就可以在應用程式管理中心的「應用程式審查」 標籤中開放應用程式給大家使用。

一次性通知 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.

傳送/接收 API

發生這種情況可能是因為下列原因:

  • 您是使用來自「Facebook 登入」 的編號。 來自「Facebook 登入」 的編號並不適用於傳送/接收 API。只有透過 Messenger Platform 驗證所取得用戶編號才適用於 Messenger Platform
  • 您是以不正確的專頁存取憑證使用編號。 Messenger Platform 專用的用戶編號有專頁範圍限制,因此是專頁限定的編號。如果您使用一個無效的用戶編號,但配搭一個與其他專頁相關的專頁存取憑證,調用就無法正常運作。請務必使用與同一個專頁相關的用戶編號與專頁存取憑證。
  • 您傳送的目標手機號碼近期內並未獲得驗證。 使用傳送 API 配搭手機號碼時,該手機號碼必須於近期內獲得驗證,我們才會傳送訊息。即使手機號碼顯示已驗證,但驗證時間不在近期內,傳送也可能會失敗。重新驗證您的手機號碼,並等待 24 小時後再試一次。

您可以改用這個方式在 Messenger Platform 整合作業中使用平台測試用戶:

  1. 在應用程式中的角色頁面中,點擊「新增」 按鈕以建立新的測試用戶。
  2. 切換為此應用程式授權測試用戶?選項,並提供「manage_pages」「page_messaging」 權限。
  3. 使用「編輯」按鈕並為此用戶取得存取憑證(使用 2.6 版)。請儲存此憑證備用。
  4. 使用編輯按鈕以測試用戶身分登入。
  5. 登入後,以測試用戶身分建立專頁。
  6. 讓測試用戶使用用戶存取憑證,以取得此用戶的專頁存取憑證。使用以下調用執行此步驟:
    https://graph.facebook.com/v2.6/me/accounts?access_token=[TEST_USER_ACCESS_TOKEN]
    文件
  7. 使用此專頁存取憑證來連結您的 Facebook 應用程式與專頁:
    https://graph.facebook.com/v2.6/me/subscribed_apps?method=POST&access_token=[TEST_USER_PAGE_ACCESS_TOKEN]
            
    文件
  8. 完成這些步驟之後,您會在測試專頁中收到 RTU 更新,並可透過測試專頁傳送訊息給您的測試用戶。 此外,如果憑證的效期太短,您還可以使用長效憑證取代您的存取憑證。請參考這裡的文件:
    GET /oauth/access_token?  
        grant_type=fb_exchange_token&           
        client_id={app-id}&
        client_secret={app-secret}&
        fb_exchange_token={short-lived-token} 
            

可以,Bot 能同時擁有這兩種訊息功能。用戶必須透過下列其中一種適用的觸發動作才能觸發標準平台訊息功能,且必須選擇接收訂閱訊息。

Bot 本身的技術設定無法於 24 小時期間外傳送用戶超過一則訊息(訊息無法傳送)。在現有 Bot 的轉換期間,這些訊息仍會經過處理,但若被發現後就會遭到標記。

不行,Messenger Platform 不提供必要的 API,因此無法針對所有已選擇接收 Bot 訊息的用戶回傳 PSID 清單。

Webhooks

收到回調要經過 2 個步驟。首先,請確認您的 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 可經過匿名處理,這樣成功狀態代碼才能立即回傳,並分開處理。

有工具能顯示近期的 Webhooks 錯誤。如果系統無法傳送 Webhooks,則 Facebook 伺服器將取消訂閱您的網址。如需尋找此工具,請前往應用程式管理中心 > Messenger > 設定。在 Webhooks 資訊卡內,您會找到名為顯示近期錯誤的按鈕

另請參閱