如果页面令牌已过期,如何退订Facebook webhook?

时间:2018-09-06 04:36:52

标签: facebook facebook-webhooks

我的Facebook应用不断收到来自令牌过期页面的Webhook。如何取消订阅,以避免不必要的传入流量?

1 个答案:

答案 0 :(得分:0)

您可以使用以下调用从页面退订应用程序: `

curl -X DELETE -F "access_token=<PAGE_ACCESS_TOKEN>" "https://graph.facebook.com/v5.0/<APP_ID>/subscribed_apps"

或通过函数调用:

  function unSubscribeApp(page_id, page_access_token) {
    console.log('Unsubscribing app from page! ' + page_id);
    FB.api(
      '/' + page_id + '/subscribed_apps',
      'delete',
      {access_token: page_access_token},
      function(response) {
        console.log('Successfully unsubscribed page', response);
      }
    );
  }

`