How to get Facebook comments for a page on my website - facebook

I can use Facebook login to login as an admin of the Facebook app that represents my website. Then, I can call this endpoint:
"https://graph.facebook.com/comments/?access_token=".$tokens["access_token"]."&ids=".$source
here, $tokens["access_token"] is an access token provided by the Facebook login process and $source is the URL for which I want to get the comments.
Facebook's API response is this:
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.
Initiating the review process for my app in the Facebook developer dashboard, the requirement for obtaining access for this is:
Please give them detailed step-by-step instructions for how to see
this permission the same way people using your app would.
And:
We need to see your app using Page Public Content Access so we can
see that it doesn't violate our policies. Upload a video screencast walkthrough using any method, (even recording with your
phone).
(In both cases, the emphasis is mine.)
I can not show what I can not show. I have no access to this endpoint, so I can not show, in action, my site using this endpoint.
What's more, I am the admin of the Facebook app representing the website for which I want to get access to the comments, and want to access the comments through that, my, account, only; I don't want any regular user account to access the comments for the pages on my website.
So, how do I get programmatic access to the Facebook comments made on pages on my website?

Related

How can I access offers of a public page via facebook graph api?

The documentation on endpoint /{page-id}/nativeoffers clearly states that we need the page-id and pages_manage_ads permissions to access offers on a public page. Also the person who requested the token should have ADVERTISE role on page. Here is the link to the documentation of graph API.
Current Situation
I have the pages_manage_ads permission on specific user_token.
The user is admin of the facebook page and have role in developer console app too.
The app is yet in development mode.
Problem:
When I try to access the offers of the page using the endpoint /{page-id}/nativeoffers, it returns me empty data despite the fact that offers are present on the page I am trying to access.
Anyone who can help me with this?

Facebook Page Access Token to display ANY public fb page feeds

I'm facing trouble in getting access_token which I need to use in displaying ANY facebook feed on the website.
I have followed the instructions here in that given link, facebook: permanent Page Access Token?, but sadly not worked for me.
Below are my API details and my requirement is to display ANY facebook page posts via PHP code in my website.
App ID: 1250216098473345
App Secret: c637f7640a185b8137e567295abe568f
All I need is a non-expire access token to put in my code to display feeds.
$userPosts = $fb->get('/ESPN/posts?fields=story,shares,likes.summary(true),comments.summary(true),full_picture,permalink_url,message,updated_time&limit=8', $accessToken);
Tried given tokens to display data of public fb pages, but failed.
https://graph.facebook.com/oauth/access_token?client_id=1250216098473345&client_secret=c637f7640a185b8137e567295abe568f&grant_type=client_credentials
https://graph.facebook.com/oauth/access_token?client_id=1250216098473345&client_secret=c637f7640a185b8137e567295abe568f&grant_type=fb_exchange_token&fb_exchange_token=EAARxEJ5xJYEBAGXFLgn98sPHGqZA74pkipbxLPTCn0jx7vtZBipmoPcG7CYaBXqRol2IUhtAI9wlX4bpFOJ1oGWSEmucCzUYKQnCwH42BnCEZARuIgEPGR3r0ZCjvI343S5yLd1C8mPLQJHNKiAOskwhmP4FU0ZC6eEvVOZB1XnWYleZA639EntpCYedUNp9itjy9c2joZBZBqAZDZD
First of all you shouldn't share you app secret publicly (hence the name).
There is no token that would allow you to display any Facebook page feed. Looking at your example call you most likely refer to pages you or your app users don't have a role in therefore you can apply for Page Public Content Access feature which then would allow you to access public page's data/feeds.
The other option would be requesting manage_pages permission from a page admin for the specific page you want to access.

Facebook app review - To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook

I want to submit my Facebook app and Page Public Content Access permission for review.
The app uses API v.3.0. To get my permission request reviewed, I need to provide "Details for Page Public Content Access" and, particularly, to create a screencast which demonstrates
How a person logs in with Facebook
How a person sees this feature used in your app
My app is in development mode. When I use the app to request posts of my own page via [https:]//graph.facebook.com/mypageID/posts?access_token=myappID|myappSecret
to make the screencast, API returns Exception : (#10) To use 'Page Public Content Access, your use of this endpoint must be reviewed and approved by Facebook`.
So I cannot demonstrate how the app works to get it reviewed. Basically a deadlock. Is there some bug in FB API ? How can I get this situation fixed?
No, that is not a bug. If your app is not in the public mode, you can access the public content of facebook pages which you or the facebook accounts you added to the Roles are admin of. As mentioned in Facebook Documentation
While you are testing your app and before you submit it for review, your app can only access content on a Page for which the following is true: The person who holds the admin role for the Page also holds an admin, developer, or tester role on the app.
You can read more about it here: https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS
So you basically need to create your own facebook page and use it in the screencast.
PS: make sure your app is in the development mode

Do review required if we want to get Facebook Page like count (Without Facebook login) by Facebook app token?

I am doing a static web page in my website, in which I am showing the like count of particular Facebook page. There is no kind of login required to see this web page. Also, I don't want to user to login with their Facebook account to see the Facebook page like count.
I have implemented this requirement by using Facebook app token.
API: "https://graph.facebook.com/PAGE_ID?access_token=APP_TOKEN"
But the problem here is, If I use the app token of already approved app by Facebook with some permissions (manage_pages) exists, it works. It is not working for the app token of newly created Facebook app.
I have sent the app for review to Facebook by requesting manage_pages permission, but they rejected the app and said that my website doesn't have the Facebook login functionality implemented.
Since it is not documented clearly, I have a doubt that do the app need to send for review if I want to get the Facebook page like count without Facebook login (By using Facebook app token)? If yes, what permission do I want to request?
Any help would be much appreciated.
First of all, you need to learn what Tokens there are:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
For your problem, you can just use an App Access Token. There is no need for any permission or Login Review, the links above tell you exactly how to create one. Make sure you never use the Token on the client, especially because it includes the App Secret. Do the API call on the server only (file_get_contents or curl, if you use PHP).
If by "it does not work" you mean that you only get the id and the name, then it´s not about "not working", you need to read the changelog and search for "Declarative Fields": https://developers.facebook.com/docs/apps/changelog#v2_4
So if you want to get more than just id and name, the API call would be like this: https://graph.facebook.com/936299239766048?access_token=YOURAPPTOKEN&fields=id,name,likes,...

Facebook Graph Api access Alcohol Related Page

I am looking for a solution to fetch the feeds of an alcohol-related/age-restricted Facebook Brand Page by a website or back-end service to show these infos in that website for any user.
i.e: https://graph.facebook.com/JimBeam
The standard call results with an error or false.
I know the reason is the age-restictrion because of the relation to alcohol.
If I am connected to Facebook and add an access_token (user-token or page-token) to the request, I get everything I need, but it doesn't work if I am not connected.
If I request the page-token with offline_access, it also does not work when I am not connected to Facebook.
I am a bit confused with all this token types, offline_access, permissions and so on.
Is possible to get the fb-graph-feed of an age-restricted page and load that into a website?
To get an age-restricted feed you need to have a user access token that meets the criteria for the page. So if a user is visiting your site, they will need to authenticate your app, and then you can use the resulting access token to pull information to your website from that restricted page.
You should not be using a user's access token to display content to another user who does not meet the restrictions on the Facebook page.
An added problem is that Facebook does not expose a page's restrictions via the API, so you can't tell if a user has permission to see the page until your API request returns no data.