Fetch public photo sources from my facebook page - facebook

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...

Related

Facebook API for getting likes count

Can anyone help me how to get my page like count of facebook to show on my website. I have tried
https://graph.facebook.com/<YOUR_PAGE_NAME>/?fields=fan_count&access_token=<EAAUo6u... - YOU_ACCESS_TOKEN>
but not able to get data. Error shows :
{
"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,
}
}
https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
You can either use a Page Access Token of your Page, or you need to go through review in order to get access with an App or User Access Token.

Facebook API: Instagram Account Is Missing

whenever creating or updating an Ad's creative, I'm getting this error:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1772103,
"is_transient": false,
"error_user_title": "Instagram Account Is Missing",
"error_user_msg": "You're using Instagram as a placement. Please select an Instagram account to represent your business in your Instagram ads, or select a Facebook Page to use instead.",
"fbtrace_id": "..."
}
}
However, what I simply try to do is to create an Ad for a specifc Page Post and add this to an existing AdSet. To create a new creative for a given Post, I use the /adcreatives endpoint and pass the following:
POST: https://graph.facebook.com/v3.1/act_<ActId>/adcreatives
{
"name": "Test",
"object_story_id":"<PostIdWithPage>",
}
This works fine so far. But the following update of the Ad results in the error above:
POST: https://graph.facebook.com/v3.1/<AdId>
{
"creative": {
"creative_id": "<CreativeId>",
}
}
I guess, the above error happens when I try to add a creative to the Ad that can not be used on Instagram.
But why isn't it working like in the Business Manager? There, I can simply select a Post for a newly created Ad. If this Post is not valid for Instagram, it shows a warning but it still works.
So, when I want to create a tool that can create Ads based on given Posts, how can I achieve that? How can we come around the error above?
The important missing part here is, that we have to specify instagram_actor_id when creating the AdCreative. The ID can be retrieved by GETting <PageId>/page_backed_instagram_accounts.
Further to the accepted answer, I needed a little bit more information to properly connect an instagram account to my page:
There are two ways to link in instagram account to your page:
1. Setup a 'Page Connected' instagram account
Log in as a page admin, go to page settings > instagram and link
an existing instagram account to the page.
You can then get the linked instagram account id by doing a GET on:
<PageId>/instagram_accounts
2. Create a 'Page Backed' instagram account.
This is for when you don't have an existing instagram account you want to link to your page, and want to instead create a 'shadow' instagram account based off your page.
You can generate a paged backed instagram account by performing a POST on the following endpoint. And retrieve an existing one, by performing a GET.
<PageId>/page_backed_instagram_accounts
** Note that both these endpoints require you to have a 'page access token' rather than the normal 'account access token' you use to create your ads.
To get your page access token, you can do a GET request on:
/me/accounts
Then, as stated in the accepted answer - pass your new, linked instagram account id as the instagram_actor_id in your ad creative request.
Sources:
https://developers.facebook.com/docs/marketing-api/guides/instagramads/
https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens

Can't retrieve posts from facebook public page via facebook API

Yesterday on the Facebook Graph API tool I could create an access_token without having to own an App then get posts/publications via {page-id}/posts or {page-id}/feed.
Today, first thing when I arrive on the Facebook Graph API tool is that I have to create an application to have access then after creating it with the same operation than before it returns me an error like this
{
"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": "FJ52hd03hq"
},
"__debug__": {}
}
Then I went see someone owning a verified application so I can try with an access_token generated with his application. The result is the same.
Anyone facing the same problem ? Did I missed something ?

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..

Permission issue when publish comment with Facebook Graph API v2.12

I am testing the facebook graph API comments
https://developers.facebook.com/docs/graph-api/reference/v2.12/object/comments
I checked my permission for the access token it contains the permission, which required by API. see the screenshot
I test my object-id (1797963943566411_1975256375837166) which is correct see me screenshot
Change the request method to POST and adding post data {"message": "haha"}
I get the error message shows:
"(#3) Publishing comments through the API is only available for page access tokens" see my screenshot
As you can see the first step checking, I have all the permission that the
API required.
Can any one see any sort of error in this process?
Try another way still not work.
I have a user who post a photo on his own facebook page.
I logged in with this user and give this user all permissions see the screenshot
enter image description here
call /me/accounts to get page access token
enter image description here
copy the page access token into the Graph API Explorer's access token field
call
GET: 1797963943566411_1975256375837166/likes
is working fine
But call POST: 1797963943566411_1975256375837166/likes
Get error response:
{
"error": {
"message": "(#200) Permissions error",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "GtEaBfyXrUD"
}
}
The reason is Facebook changed the API behaviour. We are no longer to use api to like any POST on our time line. API can only like or comments on facebook page. Sad face !!!!