How can I get posts from public pages with Graph API? - facebook-graph-api

I have Graph API Facebook. As shown as when I get my Posts that work. but when I get public page that not wok and get error (#100) Pages Public Content Access requires either app secret proof or an app token. I generate token with all permissions but not work.
My posts(worked):
JasonStatham posts(not work):

You can do this via official GraphQL QPI, in specific the /page-post endpoint.
There is also a good example here of how to do that with Python.
However, you need to keep in mind that in order to use this API you need to have a Facebook Application with 'Page Public Content Access'.
To get that permission your app must be a verified Business app.

Related

How to get the page ID from a public notion page url without querying a database

I would like to be able to receive a public Notion page URL and return the ID of that page. I don't know if that is possible using the API.
I've tried taking the end of this URL and using it to retrieve the page in postman
https://www.notion.so/asnunes/Simple-Page-Text-4d64bbc0634d4758befa85c5a3a6c22f
https://api.notion.com/v1/pages/4d64bbc0634d4758befa85c5a3a6c22f
But it didn't work :/
The ID of the page is that alphanumeric string at the end of the URL before the query parameters. This would be what you would use when retrieving information from the page using the GET Page or GET block endpoints in the API.
If you do not have access to the page (i.e. your integration does not have access to the page in your workspace) you will not be able to use the API to make a request to it. You cannot use integrations to request information from other workspaces. Your integration is not authorized to access other workspaces.

Get public facebook pages feed via graph api

I want to get my hands dirty with code and start working on some small projects, so I decided to work on a facebook scraper that pulls feed from a public page and sends results via email.
when I try the URL : https://graph.facebook.com/page_id/posts?access_token=APP_TOKEN, I'm getting " This endpoint requires the 'manage_pages' permission or the 'Page Public Content Access' feature.
What am I missing?!
Thank you <3
In order to pull the feed with the Graph API, you need to:
Manage the Page, and use a Page Token of that Page to get the feed
or apply for Page Public Content Access, if you do not manage/own the Page

Pulling Public Account Information Using FB API

I am trying to pull information(name, posts, email, etc) of arbitrary public Facebook accounts. I have a Facebook App. However, I am unable to pull anyone's data because there is no "universal access token" that would allow me access every public account's data.
To test the app, I made a dummy Facebook account and gave that account a developer role in the app. Based on Facebook documentation, since my app is in development mode and the dummy account has a role in the app, I should be able to pull its data. Even with an access token where all of the boxes are enabled, I am still unable to access this data.
Suppose 123456789 is the Facebook id of account I am trying to get info from
Get request from admin account - GET/v3.3/123456789?fields=posts
I expected to get a list of all of the posts from the user; however, I get:
{
"id": "123456789"
}
Is it still possible to pull public account data through Facebook? I know that to do so in live mode, I will need to get Facebook to approve a Page Public Content Access feature, but I am unable to get to that point, because I cannot access public posts in development mode.
If this is about User Profiles:
It is not possible to get ANY data of a user without his explicit permission. You donĀ“t even get an ID of the user without him authorizing your App first. For accessing his posts, you would even need an additional permission (user_posts). For accessing his email, you would need the email permission.
If this is about Pages:
You need to apply for Page Public Content Access in order to get access to posts of Pages.

How to generate correct access token when my app already has Page Public Content Access

Our team is creating an app that analyzes Facebook reviews/recommendations. We have submitted an initial version of the app to FB for approval to use Page Public Content Access (PPCA), and have been approved. However when we started testing it after approval and after going to Live mode, we have not been able to generate any tokens that enable us to access the public content we are looking for.
There was a similar question posted recently, 54943575/facebook-graph-api-review-rating-data-with-page-public-content-access. However the answers that appeared for that one said that you can't access this content without manage_pages permission for each individual page, while the FB documentation clearly says you can do so with the Page Public Content Access: "Allows read-only access to public data on Pages for which you lack the manage_page login permission. Readable data includes business metadata, public comments, posts, and reviews." It is true that you need manage_pages in order to write, e.g. delete or post, content to any pages. The documentation also says that with PPCA permission, an allowed use is "Provide aggregated, anonymized public content for competitive analysis and benchmarking", for which clearly you would not be able to get manage_pages permission for all pages you access.
What this question boils down to is this" is the FB documentation for PPCA correct, and if so, how can we generate the access token(s) needed to use it, now that we have it?
Update: the following graph call (from the FB Graph API SDK for Python) that retrieves "posts" does work:
page_posts = graph.get_connections(id=getpage_id, connection_name='posts')
While the following one that attempts to retrieve reviews/ratings, does not:
page_reviews = graph.get_connections(id=getpage_id, connection_name='ratings')
The latter call produces the error:
(#210) A page access token is required to request this resource.",
"type": "OAuthException",
The Facebook Developers documentation says that the Page Public Content Access applies to ratings as well as posts, but this appears to contradict that, unless we are calling the graph incorrectly here.
You can only get a Page Token of Pages you manage - for other Pages (and Page Public Content Access), you can just use an App Access Token. More information: https://developers.facebook.com/docs/facebook-login/access-tokens/
For ratings/reviews, you MUST use a Page Token. Page Public Content Access only gives you access to the Page feed and photos, for example.

Why http://www.friend.ly can get information when I don't confirm

I really surprise when use http://www.friend.ly site. I'm login Facebook and after go to http://www.friend.ly. I'm surprise because I don't confirm extended permission but this site can get email, address... Any ideas?
My Information
Information get from friend.ly site
They are using the Facebook Registration Plugin which basically renders an iframe from Facebook's server. Due to cross-domain browser restrictions, they can't actually access any of that data until you submit the form by clicking the register button.
If you read the section on the Graph API documentation about authorization you'll see that if they're using an OAuth 2.0 access token then they can retrieve any information that you have publicly available without your authorization. You can see the examples below.
The Graph API as such allows you to easily access all public information about an object. For example, https://graph.facebook.com/btaylor (Bret Taylor) returns all the public information about Bret. For example a user's first name, last name and profile picture are publicly available.
To get additional information about a user, you must first get their permission. At a high level, you need to get an access token for the Facebook user. After you obtain the access token for the user, you can perform authorized requests on behalf of that user by including the access token in your Graph API requests:
https://graph.facebook.com/220439?access_token=...
For example https://graph.facebook.com/btaylor?access_token=... (Bret Taylor) returns additional information about Bret Taylor.
The Graph API uses OAuth 2.0 for authorization. Please read the authentication guide which provides details of Facebook's OAuth 2.0 implementation, how to request permissions from a user and obtain an access token.
Getting an access token for a user with no extended permissions allows you to access the information that the user has made available to everyone on Facebook. If you need specific information about a user, like their email address or work history, you must ask for the specific extended permissions. The reference documentation for each Graph API object contains details about the permissions you need to access each connection and property on that object.
This quote is from the facebook documentation located here:
https://developers.facebook.com/docs/reference/api/