Reputation: 1337
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.
Upvotes: 2
Views: 9509
Reputation: 71
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.
`curl -i -X POST "https://graph.facebook.com/{page-id}/subscribed_apps
?subscribed_fields=feed
&access_token={page-access-token}"`
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.
Upvotes: 1
Reputation: 1462
It is described in the Graph API reference:
https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/#Creating
Upvotes: 3