Upload photo to facebook group Graph API - facebook

I'm trying to make a post with photos as attachments to my facebook group where I'm admin using user access token. Permissions:
user_birthday, user_hometown, user_location, user_likes, user_events, user_photos, user_videos, user_friends, user_status, user_tagged_places, user_posts, user_gender, user_link, user_age_range, email, read_insights, read_audience_network_insights, publish_video, manage_pages, pages_manage_cta, pages_manage_instant_articles, pages_show_list, publish_pages, read_page_mailboxes, ads_management, ads_read, business_management, pages_messaging, pages_messaging_phone_number, pages_messaging_subscriptions, instagram_basic, instagram_manage_comments, instagram_manage_insights, publish_to_groups, groups_access_member_info, leads_retrieval, public_profile, basic_info
I tried multi-photo story solution: https://developers.facebook.com/docs/graph-api/photo-uploads#publishing-a-multi-photo-story
For each photo in the story, upload it as published=false using the /user-id/photos endpoint.
but with published=false I'm getting error:
"message": "(#200) Requires extended permission: publish_actions"
With published=true it works as expected (publishing new single photo to group), but I don't need that functionality. I can't even upload to my photos (me/photos endpoint) with published=False, same error.

That solution only works for Pages (and appearently user profiles, according to the docs), because on Pages you can also schedule posts with that parameter. In groups, you can only publish immediately.
Btw, publish_actions is deprecated, you should read this: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#login-4-24

Related

What is the permission scope of publishing a post users wall in Facebook Graph API?

I published a post to page successfully by using Facebook Grap API over postman tool.
There are informations below for publish post in a page:
Post Request: {{url}}/{{pageId}}/feed?access_token={{page_access_token}}&message=This is a test
Scope: pages_manage_posts,pages_read_engagement,pages_read_user_content,pages_show_list
But I want to publish a post to user's own timeline (other says user's wall).
I explore this link https://developers.facebook.com/docs/graph-api/reference/post#Creating
They wrote this: You can publish posts by using the /{user-id}/feed, /{page-id}/feed, /{event-id}/feed, or /{group-id}/feed edges.
Then I used below informations for a publishing a post on user's wall.
Post Request: {{url}}/{{userId}}/feed?access_token={{user_access_token}}&message=This is a test
Scope: pages_manage_posts,pages_read_engagement,pages_read_user_content,pages_show_list
After trying it didn't work. Response is:
{
"error": {
"message": "(#200) If posting to a group, requires app being installed in the group, and \\\n either publish_to_groups permission with user token, or both pages_read_engagement \\\n and pages_manage_posts permission with page token; If posting to a page, \\\n requires both pages_read_engagement and pages_manage_posts as an admin with \\\n sufficient administrative permission",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "*****"
}
}
{{url}} are tried as https://graph.facebook.com and https://graph.facebook.com/v14.07
Which scopes, url and path should I use?
How can I achieve this?
Thank you

Facebook Graph - Instagram Business ID: not always returned for the same page

I'm facing to a strange issue with Facebook Graph API: for a given Facebook Page, the API does not always retrieved the Instagram Business ID associated.
My client have his page "WonderfulClientPage" which he is owner and admin.
He invited me to be administrator of his page. So, both of our Facebook accounts have the MANAGE role.
When he trying to get his Instagram Business ID from the Graph API through our Facebook App, it does not working: the API replying without the ID. The API response:
{
"id": "100[...]966"
}
But, when I'm doing the same with my account, it's working fine:
{
"instagram_business_account": {
"id": "178[...]519"
},
"id": "100[...]966"
}
When tried to do it with another account, freshly invited as an administrator: it's working !
It seems it's mandatory to be a "recent" administrator of a page to retrieved the Instagram Business ID ... It's look liker weird.
The HTTP request:
GET https://graph.facebook.com/v11.0/100[...]966?access_token=EAAGqeRDgkT8BAF[...]WMc90asIcZD&fields=instagram_business_account
Data from Token Debug (https://developers.facebook.com/tools/debug/accesstoken/):
Type: User
Valid: True
Origin: Web
Scopes: email, read_insights, pages_show_list, ads_management, business_management, instagram_basic, instagram_manage_insights, instagram_content_publish, pages_read_engagement, pages_manage_posts, public_profile
Does someone had the same issue ? Is there something else I'm missing to explain that ?

Permission error when post message to wall

I am getting the following error when post to fb feed when using POST. It's working fine with GET method. Is there any permission needed to add.
message: '(#200) If posting to a group, requires app being installed in the group, and \\\n either publish_to_groups
permission with user token, or both manage_pages \\n and
publish_pages permission with page token; If posting to a page, \\n
requires both manage_pages and publish_pages as an admin with \\n
sufficient administrative permission, I20191112-19:45:36.182(5.5)?
type: OAuthException, I20191112-19:45:36.182(5.5)? code: 200,
I20191112-19:45:36.183(5.5)? fbtrace_id: AJbuFD_SHxv-s8iOWWyZIVg
}
graph.post("me/feed", wallPost, function(err, res) {
console.log(res); // { id: xxxxx}
});
Thanks
Publishing to a user profile is not possible anymore: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#login-4-24
You can only use Sharing Options, but there is no API for it with publish_actions being gone.

Getting Facebook timeline

I am fetching my timeline from Facebook and I successfully able to get my timeline but when I login with my friend's Facebook account I received the following error-
{
"error": {
"message": "(#200) Requires extended permission: read_stream",
"type": "OAuthException",
"code": 200
}
}
I am the admin of the application on Facebook developer but my friend is not.
I have already approved following permissions from Facebook(see attached screen shot)
And below is the permission which I am using in my code-
FBSession* sess = [[FBSession alloc] initWithPermissions:[NSArray arrayWithObjects:#"public_profile",#"user_friends",#"user_birthday",#"email",#"user_education_history",#"user_work_history",#"user_hometown",#"read_stream",#"user_about_me",#"user_posts",#"publish_actions",nil]];
And here is the code to getting the timeline-
NSString *urlStringFacebook = [NSString stringWithFormat:#"https://graph.facebook.com/me/home?format=json&&access_token=%#&&limit=90",[[FBSession activeSession] accessTokenData]];
If I submit the read_stream permission to Facebbok for review the reject it due to the following reason(see screenshot below)-
And one more thing when I login with my account they ask me to allow for news feed(read_stream) permission but when my friend login they don't ask for that permission.
When I try to get the same thing on Graph API explorer then the data comes fine.
Please let me know what I am missing in the whole process.
Thanks
You are trying to use /me/home, which needs read_stream as you can read in the docs: https://developers.facebook.com/docs/graph-api/reference/user/home
...and that permission will not get approved: https://developers.facebook.com/docs/facebook-login/permissions/v2.3#reference-read_stream
Use /me/posts or /me/feed instead, those endpoints need user_posts and you got that permission approved already: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed
Btw, this is explained very well in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_3_new_features
You can get Home Timeline post using user_posts.
Using /me/feed you can get all post from others and you. go to Developer graph API Explorer Graph API Explorer.
Use /me/feed instead of /me/home, with the already granted user_posts permission this should work. This endpoint also returns other posts from the user's timeline, not only those from the user himself (/me/posts)...

I can post links in a page feed but not just a message

I'm trying to post to a facebook page (as the page and as the admin user with each one access token) with just a parameter 'message'.
I've the same error in php and in Graph API Explorer in both cases:
{
"error": {
"message": "(#1) An unknown error occurred",
"type": "OAuthException",
"code": 1,
"error_data": {
"kError": 1455002
}
}
}
The same post to the API adding a paremeter link or just link without message works fine.
The user has granted those permissions: create_note, email, manage_pages, photo_upload, publish_actions, publish_stream, share_item, status_update, user_friends, video_upload.
The app is in Sandbox Mode and the user is a test user, not a real one.
I'm able to write to user feed and to create custom actions for him.
I've verified both, the page access token and the user access token with Access Token Debugger.
I've already reviewed a lot of questions in stackoverflow, tutorials and blog posts.
What am I missing?
UPDATED: I can't either post a link in page with app access token.