问题
Introduction
I have a Facebook APP and it is already published and approved to access the manage_pages
and pages_messaging
permissions. Facebook Login and Messenger are also installed. I also have a Webhook set and it works well.
My objective I would like to make it easy for my users to create and publish a bot within the app, like what Chatfuel does. The user logins in using Facebook, create a new bot, link to a page and automatically the bot is available for use. The user will not be involved in manual configuration of the bot publishing process but rather simply pointing the page they would like the bot to appear.
What I have done so far
- Login user with Facebook and collect their
access_token
anduser_id
using theapp_token
- Using the token, retrieve the pages owned by the user
GRAPH_API_URL/me/accounts?access_token=USER_ACCESS_TOKEN
- From the results obtained above, I'm able to display the pages to the users for them to choose where to publish the bot. I'm able to get the selected
PAGE_ID
andPAGE_ACCESS_TOKEN
for use in the next step - I then send a
POST
request to subscribed the app to the page. Remember the app is the same one they used to login and approve the needed permissions as per my defined scope ('email', 'public_profile', 'manage_pages', 'publish_pages', 'pages_show_list'
)
Subscribing app to a page, I send a POST request to:
https://graph.facebook.com/v2.10/PAGE_ID/subscribed_apps?access_token=PAGE_ACCESS_TOKEN
The response I got was a success:
{"success": true}
The Problem Using the pages I own the process works well and I'm able to chat with the bots and from the app dashboard I can clearly see the pages have been added to the subscription list. My users are able to go through the all process, and from the logs, they also get a success response but their pages are not added and they cannot chat with the bot. To verify their subscriptions, I sent a GET request to https://graph.facebook.com/v2.10/PAGE_ID/subscribed_apps?access_token=PAGE_ACCESS_TOKEN and the response is positive as shown in the example below:
{
"data": [
{
"link": "http://mywebsite.com/",
"name": "MyApp",
"id": "1438393....."
}
]
}
From the highlighted steps, is there anything I might be missing? How can I get the above done properly? Thanks in advance for your input.
来源:https://stackoverflow.com/questions/46883836/facebook-graph-api-subscribed-apps-edge-only-works-with-pages-i-own