Facebook Graph API: Unable to reply a comment on unpublish page? - facebook

I'm using the Graph API Explorer to reply the comments on fan page via my app.
It works only the page is published. However, it bothers me so much.
How do I to test the app before publishing the page?
What I'm trying to do is the app will listen to the webhook from Facebook and then reply to the comment as long as got a comment.
I've been search for a while, there's very few questions related to this. Any suggestion would be thankful. ;)
// POST
https://graph.facebook.com/{comment-id}/comments
// response when the page is unpublished
{
"error": {
"message": "(#200) Cannot access object_id: {comment-id}",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "{fbtrace_id}"
}
}

Confirmed that you can't access the comments while unpublished as the page id prepends the comment id. I would say quickest and easiest way to test is to just create a separate test page and keep that published.

Related

Fetch public photo sources from my facebook page

I'm trying to fetch the public photos I've posted on my facebook page.
With that, I plan to make a caroussel on my website that displays the photos I posted on my facebook page.
Using the facebook Graph API, I ended up with this:
my-page?fields=albums.fields(photos.fields(source))
The thing is that the response I get is:
{
"error": {
"message": "(#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.",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "DxhgQ12ym3r"
}
}
I've tried to get the app reviewed, but at certain point they ask me to attach a video in which I show how the final user will use the app. But this is a server-to-server app, so I don't understand how am I supposed to answer that petition.
I've also tried to get a page access token, but I get the following error:
Invalid Scopes: manage_pages. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions
I'm quite lost, if anyone could guide me a bit or explain me step by step how to reach my goal...

An unknown error has occurred with graph Facebook

I have an element on my website which shows facebook posts from a page and the amount of views/likes/comments. This stopped working all of a sudden and I have no idea why.
If I make the request with the graph api tester tool I get:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "CIHVxFhXIv/"
}
}
This is the request link I use with file_get_contents:
https://graph.facebook.com/v3.0/idofmypage/posts?fields=comments,full_picture,likes,message,picture,story,permalink_url,updated_time,from,insights.metric(post_impressions)&access_token=myaccesstoken
Did something change again with permissions or maybe a field is deprecated?
According to this fb new the Pages API and others have changed, and now you can only access the data if it's a page of your own.
Pages API: Until today, any app could use the Pages API to read posts or comments from any Page. This let developers create tools for Page owners to help them do things like schedule posts and reply to comments or messages. But it also let apps access more data than necessary. We want to make sure Page information is only available to apps providing useful services to our community. So starting today, all future access to the Pages API will need to be approved by Facebook.
Today I've started a project wich, in the begging, I need to recollect data and that's what I've found about it..

Commenting on posts Facebook graph api V2.10

Is it possible to comment on any post using the id of the post ? I tried with the V2.9 and the comment is successful but when I tried it with V2.10 it shows me the following error
{
"error": {
"message": "(#3) Publishing comments through the API is only available for page access tokens",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "B7DlJt0HMOL"
}
}
This is what I did in the Graph api Explorer
When I switch the version to V2.9 the comment in the post is successful. Why does this happen or how can I fix it?
The error message tells you what the issue is, commenting on everything else than Page posts is deprecated since v2.10 and will not work anymore:
90-Day Breaking Changes
POST and DELETE /{comment-id} — This node now requires a valid page access token.
For more information, take a look at the changelog: https://developers.facebook.com/docs/graph-api/changelog/version2.10

Facebook Graph API | Page feed

I am having a problem with the facebook graph API, when I try to read a Page feed using graph../{pageId}/feed it works only for some pages. On other pages I get the following error:
{
"error": {
"message": "(#200) Requires extended permission: ads_management or manage_pages",
"type": "OAuthException",
"code": 200
}
}
The Page is restricted by location, as we found out in the comments. If it works for one user, most likely the other one is not allowed to view the page - which means that you can´t grab the feed with his User Token. The Page could also be unpublished, but i guess that´s not the case.
If you are unsure, try lifting the restriction and test it.
If that does not work, you should file a bug.

Fetching a Facebook page's events?

I am trying to fetch a Facebook page's events. I have before, but it doesnt work any more. I used this scriptto fetch the events.
$string = file_get_contents("https://graph.facebook.com/?$pageids&fields=events.limit($fblimit)&access_token=$token&method=GET");
$json_a=json_decode($string,true);
$pageids was a lot of different facebook ids (id1,id2,id2 ...)
I get this error message:
{
"error": {
"message": "(#100) Unknown fields: events.",
"type": "OAuthException",
"code": 100
}
}
Does anyone know what is wrong with my script? Is there a another way to fetch Facebook events?
The actual URL to get a page's events is something like this :
https://graph.facebook.com/PAGE_ID/events
I'm not sure how old the code is that you are fixing, but this is the correct method as stated in the documentation. events is a connection of the page object.
Reference: https://developers.facebook.com/docs/reference/api/page/#connections
Facebook has had restricted access of Events in API recently.
You have to do app review to have access to Pages API, Events API.
Please check section "Apps that Require App Review, Business Verification, and Supplemental Terms" of this url: https://developers.facebook.com/docs/apps/review