Retrieve comments from an implementing facebook comments website - facebook-graph-api

I can not get Facebook Graph Api to retrieve comments from websites that implements facebook commenting system.
I want to provide sentiment feedback statistics for various websites. I wanted to retrieve comments from few websites which are implementing facebook commenting system, I found graph API method /{object-id}/comments
which should return set of comments from specific object-id (which is an url of article consisting set of facebook comments?). I keep getting json response with ID only or an error with "(#10) 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." message. Any feedback on that?

/{object-id}/comments is for objects on Facebook - posts, comments, videos, etc. An external website that uses the comments plugin, doesn’t fall under that to begin with.
What you want, is this here - https://developers.facebook.com/docs/plugins/faqs#faq_1603507626630008:
Can I get comments for a URL via an API?
The comments for every URL can be accessed via the Graph API. Simply make an HTTP GET request to:
https://graph.facebook.com/v2.6/?fields=og_object{comments}&id=<YOUR_URL>&access_token=<YOUR_TOKEN>

Related

Test Facebook Graph API without Page Public Content Access permission

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.

Facebook Page Public Access Content permission: competitive analysis and benchmarking only?

I would like to write a backend application that retrieves public posts from Facebook pages that I don't manage, using the graph API. As an example the last 5 posts of the local pub page.
According to the feed documentation, I need to manage the page or request the Page Public Content Access permission.
The Page Public Content Access permission is mentioning the following as allowed usage: 'Provide aggregated, anonymized public content for competitive analysis and benchmarking'.
This sounds very restricted to me.
Is it possible and allowed to let my backend application retrieve public Facebook posts and show them in my mobile application as feature?
Most references on StackOverflow refer to issues that are related to API changes that have been made.
I'm trying to understand what is allowed and what not but it is hard for me to extract this from the documentation on the developers page.

Accessing Page Public Content - App Review Required, but why?

I started to work at a company and I was given the task to use graph API to get a given sites public posts and its reactions and make statistics saved to a database, using nothing personal, only the things everyone can see. I need Public Page Content Access to do so but I must submit it for review which I can't because I need a feature for it which I can't develop because I need PPCA and so on...
However ( if I understood it correctly ) it was written if "My app" has someone who has the role of admin on that given page and is tester/developer/administrator then I can freely access that pages content without submitting. And this parameter checks, but the graph request still gives me this error:
https://graph.facebook.com/v3.2/page-id-with-admin-in-app-project-as-admin-too/feed?access_token=access-token
(#10) 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."
Did I miss something? Or should it be submitted anyways?

how to share page post using facebook api

There is very good and simple answer for question "how to hide page post using facebook api". Thanks a lot.
Question "i want to share friend's post via graph api" still has no answer. How come?! :)
Does anybody know how to share Post (via Graph API) from some Page (on any possible destinations: Your timeline, friends timeline, in a group …)?! Any reference to Facebook documentation will be highly appreciated.
Thanks to Maria Lucinda da Fonseca: https://groups.google.com/forum/#!topic/restfb/a94wO_KyZUM
String _destination = "me/feed"; // or "Page_id/feed"
String _linkToPost = ...;// here should be FQL stream.permalink see link to FB doc below
FacebookType publishMessageResponse =
facebookClient.publish(_destination, FacebookType.class,
Parameter.with("message", "Your message is here"),Parameter.with("link", _linkToPost ));
Also, you can share a LINK by exactly the same way: just change _destination to "me/links" or "page_id/links" and replace _linkToPost with real URL from browser or FQL link.url
FQL STREAM object
FQL LINK object
Graph api sharedposts edge
according to the above link "You cannot publish shares of an object using the Graph API."
When you attempt to use the answer provided in Maria Lucinda da Fonseca's post, Facebook graph api responds with a user error message of
"error_user_msg": "One or more of the given URLs is not allowed by the Stream post URL security app setting. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. Read https://developers.facebook.com/docs/facebook-login/security/ to learn more about app settings related to security."
While it is possible to share links using the graph api, sharing facebook links is not allowed.

Facebook API - what kind of authentication is needed now to query a page's tagged posts?

https://developers.facebook.com/docs/reference/api/page/
I want to be able to get the tagged posts for a page (e.g. harvard). what kind of authentication do i need to have (access_token) or do in order to be able to get those posts? they are publicly available.
You answer lies in the link you posted (https://developers.facebook.com/docs/reference/api/page/)
In the connections section, it says "any valid access_token or user access_token":
tagged
The photos, videos, and posts in which the Page has been tagged.
any valid access_token or user access_token
a heterogeneous array of Photo, Video or Post objects.
So if this is incorrect, you can scroll to the bottom of the link and click the Report Bug link to report an error in the documentation.