Messages from Facebook Graph API without "/pageid/conversations" endpoint - facebook

I'm trying to access messages that belong to a page where I have a 'page advertiser' role. I was trying to use the Facebook Graph API/{pageid}/conversations endpoint, however it seems that I need to have an admin, editor or moderator role to get the required permission.
Assuming that I cannot change my page role, is there any other API or permission that let's me access messages that belong to a page? I know for a fact that Chatfuel can access messages that belong to pages, but I'm not entirely sure what page role they get (perhaps they do ask for a permission to become an admin, editor or moderator of the pages that they build chatbots for).
Within the Facebook page settings admins can access subscribed apps under settings/messenger platform (where Chatfuel gets listed too), however I'm not sure how my app can request to become a subscribed app for a page that I only have an advertiser role.

Related

Getting Facebook page access token only for app admin

I have a livestreaming (consumer) app with an associated Facebook page, and my goal is to broadcast streams from my app onto my Facebook page (live).
I have understood that part of the process to do this is getting a page access token from an admin of the page (like myself), who has granted my app the pages_read_engagement and pages_manage_posts permissions (which I have not done). However, in order to request those permissions, it seems like I would have to change the status of my app in Facebook (from being a consumer app), add those permissions, and undergo app review, even though I only want to request those permissions from a specific user. (This particular method is also not possible, since I already have 200,000+ users actively using my app.)
So my question is, how can I get a Facebook page access token for only a specific user of a specific page?

How to request page messaging permissions on facebook apps?

When using facebook apps like chatfuel and manychat (which are bot creation platforms), these apps request permissions that allow them to manage my pages and send messages.
I want to create a similar app that allows users to send messages from their pages through my app, but I can't find how to request such permissions in Facebook's documentation.
You need to be given the administrator role for each Page, then connect your app to the Page and generate a page-scoped token for each one.

Creating ads for another user's page without validation

I see Mailchimp has a feature to create facebook campaigns through its UI and I can't understand how they just need to have access to one of my pages to create ads for it.
As far as I understand you need to be a business manager administrator to claim a page as agency with the ADVERTISER role (cf. https://developers.facebook.com/docs/marketing-api/businessmanager/assets#pages) but
If the user who makes an AGENCY claim call does not have the proper permissions on the Page, the response will be PENDING. The Admin for that Page may login and grant the access, deny it, or even report the claim as a spam.
So how come Mailchimp doesn't require this validation?
So there is another way which doesn't involve business manager directly: adding a system user as advertiser.
Assigning permissions to a page from the API requires special permissions. Please reach out to your Facebook rep if you require this feature.
My team is still in the process to “reach a facebook rep” (it's been two weeks already…) but once this will be done a simple POST to <PAGE_ID>/roles with
admin_id: system user ID
role: Advertiser
should allow to create ads for pages using the system user access token.
Turns out facebook desn't want you to use the features they advertise, so there's in fact no solution.

Facebook API authorization - one login, multiple domains

Our application runs multiple sites for multiple customers. One service we offer is to write and post social media for our customers. We also allow the customers to do posts themselves through the application admin.
In order to facilitate the non-automated posts for customers, one of our users has access to the pages of many customers through her Facebook login.
The problem comes if she uses our application to generate an auth token through the admin area of the customer's site.
The application sends its own appID and secret key to Facebook, and the user receives the Facebook login page.
However, she used to be able to choose which page/customer she wished to log in to. Now, once the login data is submitted, Facebook immediately sends a token back to the "return URL." There's no opportunity to choose which Facebook page the auth is for.
The token appears to be linked to the user's "main" page (which is a page of ours).
Obviously, we need to be able to say "I'm logging in to Facebook page X of the many pages I'm authorized for."
Just to be clear: this is not an issue regarding authorization for our application in general. It's the specific case when the Facebook login is attached to multiple pages.
Can anyone give me some advice, please, even if it's just a link to an appropriate spot in the API docs? I've had no luck searching them.
Thanks,
Tom
Edit: First, to the question about "multiple domains": perhaps I shouldn't have put that in the title, since it's not relevant to Facebook per sé,
We host many clients who obviously have many domains. They administer their site content through a CMS which can, among other things, work with Facebook. A client often has a Facebook page; so for us at least, there is often a one-to-one correspondence between a client's site/domain and her/his Facebook page.
When someone goes through the process in question, s/he is administering the site, but may be attempting to post to a Facebook page. And one of our in-house admins has access to many clients' Facebook pages.
So let me rephrase: the admin logs in to a client's site. She attempts to authorize our application to post to that client's page. Our application sends its id/key data to Facebook, and she is taken to the login page.
The question is, how do we let Facebook know that we are seeking authorization to post to one of the many accounts/pages she can access?
Thanks for the help.
As pointed out by CBroe in the comment, if you want to post as a page, you need to have a page access token of the page that you admin. Once you have granted manage_pages permission to the app, you can call the /me/accounts edge to get the list of all pages that you admin and their access tokens.
You can then use the page access token of the page to post on behalf of the page. Note: You will need publish_pages permission in addition to be able to post on behalf of the page. Permissions are documented here.

How do I grant my app permissions on pages or groups I created?

I have an app, and I can write to user's walls with it, having requested the publish_stream permission when they sign in.
I've also created a page and a group, and would like my app to be able to write to those. (Specifically, I want my back-end server to post some updates to those periodically, without a user being involved.) The ability to do this seems to be implied by the descriptions of the /feed parts of those here https://developers.facebook.com/docs/reference/api/page/ and here https://developers.facebook.com/docs/reference/api/group/ . However, I can't seem to find a way to authorize the app to write to these pages. Those docs say it can be done if you have publish_streams and manage_pages. OK, but how do I grant those to my app?
In the user case, you request those permissions when the user signs in via the OAuth flow. However, the page and the group never sign-in, so there's no way for them to grant the app permission. I looked around the settings pages for the group and the page, and couldn't find anything that will let me add the app. So how do I give the app the required permissions to post to the group and the page?
Found it!
http://developers.facebook.com/docs/reference/api/application/
http://developers.facebook.com/docs/howtos/login/login-as-page/
"Application Page Access Tokens
To perform the following operations as an Application Page, and not the current user, you must use the Application's Page access token, not the user access token commonly used for modifying Graph API objects nor the Application access token. This access token can be retrieved by issuing an HTTP GET to /USER_ID/accounts with the manage_pages permission. This will return a list of Pages (including Application profile pages) to which the user has administrative access, along with an access_token for each Page.
Note: Applications that are configured as Native/Desktop apps will not be able to make API calls that require an application access_token."
So:
I went to http://developers.facebook.com/tools/explorer/ and, as me, created an access token with "manage_pages" permission.
I then went to https://graph.facebook.com/$myname/accounts?access_token=$accesstoken
and it gave me a list pages and apps that I had given permission to. I copied the access_token from the relevant page, and pasted that into my code, so that the server-side create event code always used that access token.
And it worked!