Test Facebook Graph API without Page Public Content Access permission - facebook-graph-api

Is there a way to test an app implemented Facebook Graph API required Page Public Content Access permission?
I was testing the {page_id}_{post_id} endpoint in Facebook Graph API Explorer to get a post, but got the error message:
This endpoint requires the 'pages_read_engagement' permission or the 'Page Public Content Access' feature. Refer to https://developers.facebook.com/docs/apps/review/login-permissions#manage-pages and https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS for details.
This error applies to both random pages and pages that I own. I couldn't use it at all. The app I've planned to do is mostly based on Facebook posts so I may say this is it's the main function, so I just can't have the app reviewed until I can test this endpoint successfully.
What can I do to make it work? Any help would be appreciated!

It turns out I chose the wrong type to create my facebook app. I chose to create a "Business Connected Experiences" app instead of a "Manage Business Integrations" one, so I couldn't fully access to the permissions I need to query on my own page. The former only doesn't provide me the pages_user_read_content and the likes, so it was unable for me to read comments from posts. Besides, I also use an user token instead of a page token (Thanks Lars for pointing this out for me).
So, I just create a new app with the right type and everything turns out well.
Hope this will help someone someday.

Related

Starting using Instagram oEmbed feature

What is the correct way to start using Instagram oEmbed feature? Documentation (https://developers.facebook.com/docs/instagram/oembed/) claims that I have to pass App Review to start using the feature. And application form says Please provide a URL where we can test Oembed Read. Which I don't have because I have no access to the feature.
What I have tried with no success:
I requested instagram_oembed resource with:
app token of application in live mode
app token of application in
development mode
passed URL to a post by official Instagram account
(e.g. https://www.instagram.com/p/CQG4gZxMzzO/)
passed URL to a post
of a user who is Admin of the app
In all cases I receive (#10) To use 'Oembed Read', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Oembed Read' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.
Example of the request I do https://graph.facebook.com/v11.0/instagram_oembed?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FCQG4gZxMzzO%2F&access_token=appAccessToken
We're also suffering from this issue, but so far, we thought we already figured out how to do that.
Big picture
Facebook had not sorted this thing out correctly. Or at least, we don't know why they put such a restriction to this API.
The official document is not correct. (or at least not accurate for now, for some part)
Which part was not correct?
The access token part is not right. Or at least, it's the most confusion part.
How can we resolve this?
Use the Graph API Explorer
Adjust your token(App token, Client access token, user token) with the official URLs(see below) to see if you can get the result
most of us should be able to get the result with user access token, which means you have to access this API after login!
Integrate into your app for review
The review page is also confusing:
Please provide a URL where we can test Oembed Read. Include the URL of a page, post or video from our official Facebook or Instagram pages, or the pages themselves., it means you can only use links like https://www.facebook.com/instagram or https://www.facebook.com/facebook
With that in mind, so far, the only way to get approved is integrate your oembed usage into your normal UI with facebook user access token ready
Question to the big picture
So, we have to ask user to login with our facebook app, then we can provide this oembed read API returned embed HTML? I'm afraid that's what we have now.
big companies might be able to apply for App Token, I guess in that scenario, facebook login is not necessary
for small companies, indie developers, hmmm, I don't know any better solutions so far.
I have run into this too. I do not have an answer at this time, I just want to report on the frustrations of their 'app review' process. Which makes it feel like you are unlikely to get it to work any time soon.
We have a custom embed code for our weblog authors to use (a shortcode kind of thing) which does the oEmbed call. We just take the HTML from the resulting JSON, and insert it into the weblog article page, and that is it. It stopped working, presenting this same error - in live mode, and in development mode.
The kicker is, I then tried submitting it for app review. Filled out everything I could to the best of my knowledge. Provided them a test account and post on our weblog to show the shortcode editing and expected placement. We got rejected. Why? Your embedding resulted in an error, we can't see it in action to approve you.
Yes. The error I am getting is that I need my 'app' to be reviewed and approved.
This is an infuriating process. This is the only Facebook / Instagram API feature we use at this point. No user data. No attempt to make an Instagram clone app or anything like that. Just an embed.
And they are making this simple use case as impossible to use as they can. And the documentation also feels like an infinite loop. They say users of the old Instagram embed call have until September 7 2021 to get approved. But the call does not work at all because we are not approved. So we cannot get approved.
Same loop here. I've managed to report it to Facebook team and get answer "Just submit your Instagram post URL"! I can't believe it, its can't be so simple. I've confirmed it few times with Facebook team person and.... get rejected!
Also, second form in App Review process will LOWERCASE all of your links and I've spent few days just to explain it to reviewers and support person. Still rejected after submitting proper url. This is insane.
My another attempt was about to build a test page where I can auth via Facebook account, parse connected Instagram accounts and GET embed endpoint with user access key in hope that reviewer HAS access to oembed feature - REJECTED. I can't even find what permission I need to add to auth URL to obtain oembed thing.
Will update my answer with new information later.
UPDATE: After reporting about the issue with lowercase URL in submission form they just APPROVED my app without APP REVIEW. Well... Facebook style...
I had exactly the same problem recently. Updated the packages with compose, changed the API version from 10 to 11... without any change.
The error was also occurring in development mode, it didn't make sense that Facebook was asking to approve in dev mode.
For me, the problem came from the management of scopes in my application, depending on the version of the Facebook API used.
My advice: check the scopes defined with API version in your code first.
I had the same issue and the solution is very simple. The only thing you need to do is copy paste an instagram url in the input field saying: Please provide a URL where we can test Oembed Read.
I did the this link: https://www.instagram.com/p/G/
Which is actually the first instagram post :) Got approved. Hope this helps everybody!

Can I do anything about Facebook returning an error about 'Page Public Content Access' after a password reset?

I've come on to help a company out at the last minute after a developer bailed, and I'm left with some annoying quirks. I'm also very green when it comes to Facebook API. I don't have all the history, but here are the facts as I know them:
I've got a Facebook application that is used by a single Facebook account. This Facebook application reads public content of various pages (pages of clients, to be more specific) on Facebook (specifically follower and like counts). Periodically on a web server, we get these numbers and update our records for said clients.
Now, this application has executed fine for months. For security reasons, we changed the password for the Facebook account associated with this Facebook app. After recreating the access token, I started getting the following error:
To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.
My question is, why now? Why did a password reset cause this? Was this app originally grandfathered into not needing to be approved, and now that a password has been reset the app needs to be reviewed? In looking at the app's permissions it does seem it wasn't approved for this feature.
The reason I'm asking is if there's some other reason why this restriction was suddenly added, I'd like to know. Perhaps it's only applicable for certain scenarios and by updating the access token I inadvertently requested some feature the previous app never did?
Thanks.
There is no way to access public pages you do not own without getting "Page Public Content Access" approved now, this was changed a while ago already. So you are probably right, it may have worked only because of the old Token.
There are two ways to solve this:
Get Page Public Content Access approved by Facebook
Use a Page Token for all the Pages - you can only get it by having a role in the Page

create page programmatically for a test user

Can I create via api pages for a test users?
This is what I did:
Given my app, I got the user's token from app dashboard test users and I tried to use it in the graph explorer (POST /user_id/accounts).
I've the error "(#10) Application does not have permission for this action".
These are the permission the app has been granted for: manage_pages, publish_pages, publish_actions
Do I miss some permission or it is not possible?
Luca
[Edited following Simon's advice and the response below:]
I've been looking into this all day and it seems the answer is a solid, "Nope."
According to the developer documentation on creating pages, the {user_id}/accounts endpoint only supports Reading, not Creating, Updating, or Deleting.
Although apparently if you apply for Standard API access, you can receive permissions to create pages. (Only available if your app is generating ad revenue.)
Googling, reading and trying, I figure out that we can create a page via api.
https://developers.facebook.com/docs/graph-api/reference/page/#Creating Applications with Standard API Access can create Pages through the API using the following paths: /{user_id}/accounts
So the answer to my question is yes, if your application has the Standard API Access, no matter if you are dealing with test users or not. Note that teh call is slow (about 5 sec.)
That's it.

How to read Facebook Insights for a Native/Desktop app programmatically

Unfortunately I'm struggling to understand the documentation provided by Facebook.
This is the scenario:
- Some of my iPhone Apps are also registered as Native/Desktop Apps on Facebook in order to support the Facebook Audience Network.
- I'm building a tool in python which will retrieve data from the reporting API in order to run some automated analysis on specific metrics (request, impressions and so on).
The question is: how do I retrieve this data?
The documentation for the reporting API is here: Reporting API
However I'm struggling with the access token.
It says that I could use the specific App Token available here: App Tokens
However by using such token, I get an error saying that app tokens can't be used for Desktop/Native Ads.
What is the correct way to do it then? Here is where I struggle to understand Facebook Documentation.
My guess is that I should use a User Access Token instead, generated for a user that is also the admin of the App for which I want to retrieve the insights.
What really freaks me out is that apparently, this can't be done with normal HTTP calls only but it requires instead to go through the Facebook Login Dialog. I also need to create another Facebook (web) app because there is no way to get a simple "User Object"... Everything needs to start and go through a registered Facebook App. And there's no way to go through these steps by using backend code only.
So... to recap... in order to read the Insights for a Native/Desktop Facebook App (APP_A), I have to:
- Create a new Web Facebook App (APP_B)
- Create a web interface somewhere for APP_B) which will trigger the Facebook Login Dialog and request the read_insights permission.
- Login through this web interface and generate a User Access Token
- Put this User Access Token in my backend code and run the scripts that retrieve the data provided by the Reporting API for APP_B
Really... to me... it doesn't make any sense to create a new Facebook App in order to access the data of another Facebook App.
Isn't there another better, simpler, quicker, cleaner way to achieve the same final result?

Best option to POST on facebook timeline

I need to make POSTs to facebook page timeline (not auto posts, but when a user on an enterprise application submits a form). Note that a user should bot be logged in on facebook!
I've searched a lot and seems i should use graph api to do this... but, it's possible to achieve this without creating a facebook app?
I don't wish any user have this app... i just need to make POSTs to a facebook page that i own. So, it's not a public app.
I've made some tests with graph api explorer, after creating an app, and i'm trying to POST and always get error "An active access token must be used to query information about the current user.".
So, i'm using the correct access token (app access token in this case)... how can i test this? I should have my app submitted to be reviewed already? I just want to make some tests, to see if this actually works as i need to... don't wish to publish app now.
Could someone point me to the right direction?
Thanks!
An App Token is the wrong Token to post to a Page. You would need to use a Page Token for that. At least if you want to post "as Page". If you want to post "as User", you have to use a User Token. Everything you need to know is in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed#Creating
More information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/