I’m trying to subscribe a Facebook page to my facebook app. It’s a messenger app where I need to subscribe the page to my webhook added in the app.
Using the graph API, I have the page access token and page id, I have tried the subscribed_apps API but it didn’t work
FB.api('/' + page.id+ '/subscribed_apps?access_token=' +
page.access_token,function (response) {
console.log(response)
});
Is there an API to make the page to subscribe to my webhook in the app.
2
Answers
It is described in the Graph API reference:
https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/#Creating
You can you the below API to subscribe the page to your webhook. Specify the fields you want to subscribe to using the subscribed_fields query parameter depends on your use case.
Example – If your use-case is related to page messaging use messages,message_echoes fields as subscribed_fields.
Note – Your page access token should have pages_messaging permission.