Failed post to group via Facebook Graph API - facebook-graph-api

I got an error after posting to a Facebook in which I'm a member:
Error: (#200) If posting to a group, requires app being installed in the
group, and \ either publish_to_groups permission with user token, or
both manage_pages \ and publish_pages permission with page token; If
posting to a page, \ requires both manage_pages and publish_pages as
an admin with \ sufficient administrative permission
It works only in a Group where I had added an App that has permission "publish_to_groups". I have tested only with a text message.
Is there any way to Post a Video to multiple facebook groups where I'm a member via Facebook Graph?

No, you can only post in groups where an admin installed your app, just being a member of that group does not suffice.

Related

Fb/Instagram Graph API: (#10) permission denied on business_discovery

I'm trying to run the following:
<my_insta_fbid>?fields=business_discovery.username(<business_page>)
on https://developers.facebook.com/tools/explorer
But I'm getting an error (#10) permission denied
My app is approved for instagram_basic, User Token also includes it
Business verification is passed too
I have Instagram Graph API and Instagram Basic Display products included
Instagram account is connected to my fb that generates user token(but created separately)
Insta account I use is included into Instagram Basic Display
Of course, I use and request instagram business accounts
I tried both Live and Development app modes
All the other requests related to <my_insta_fbid> like name or biography work. The only that fails is business_discovery
What else am I missing?
I found it!
My tests have shown that I was missing the instagram_manage_insights permission.
I didn't find any mentions of this in the documentation but it worked in my case

Facebook Graph API post to group fails with prod app but works in test app

I have been developing an app to post to a clients Page or Group
I have been using the test version of the app and have successfully posted to both a users group and page after the user authorizes my app via facebook login.
The app just went through the approval process and has been approved, so now i am testing the real app.
Using the Real app creds, i can post successfully to the users page, but when i try to post to the same group i have been posting to with the test app, i get the error
status-->403 error={\"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
These are the permissions i have
email,
pages_show_list,
publish_to_groups,
groups_access_member_info,
pages_read_engagement,
pages_manage_posts,
public_profile
Thanks for any help

Post to a Facebook page that I manage using Graph API

I am posting to a facebook page I manage using facebook API. Till yesterday I was able to post using facebook graph API. Suddenly I started seeing the permission issue for publish_pages permission. It is as if this specific permission has been revoked from the token (I verified using token debugger). When I try to generate a new user access token with relevant publish_page permissions, I do not see the permission for publish_page in the graph explorer.
The token I was using was generated using user access token with relevant permission to get a token for page.
From doc I see that we do need App review for publish_page permission. But so do we need it for manage_page permission. My token has manage_page permission and I can see option for this manage_page permission in graph explorer when I generate user access token.
I see option to get publish_page permission when I try to generate token for page. But when I try to select the option I get below error:
Invalid Scopes: publish_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
Do I need to get my app verified before I can post to page I manage?
What else can I try?
There is a bug report about this: https://developers.facebook.com/support/bugs/2261820083829739/
I still get an error for one of my Apps that was working before, so I can confirm that it is still not fixed:
Invalid Scopes: read_page_mailboxes, instagram_basic,
instagram_manage_insights
Edit: Just found another bug report about it: https://developers.facebook.com/bugs/600976503711113/

Facebook Messenger subscribed apps, page and app access token generation

I am hitting a wall while developing seamless integration of a Facebook page with my bot.
Essentially I want to achieve same integration than Chatfuel or Manychat have, where being logged in with your Facebook account lets you to just choose what page you are connecting to them and you are good to go.
The problem I am facing is generating the proper token in order to bind the selected page to my app (bot). As per Facebook documentation:
When you create a subscribed_apps edge, the page-id you use in endpoint must match the page ID of the page access token used in the API call. The app that the access token is for is installed for the page.
Given the call has no other parameter than the access token, this access token has to be enough for Facebook to:
Authorize the action on the page.
Identify what app is being subscribed to the page.
This is confirmed while using the Facebook Graph API Explorer, where one selects the page and the app to bind and a proper access token is generated:
This token properly works using cURL in the terminal:
$ curl -X POST 'https://graph.facebook.com/v3.0/<MY_APP_ID_HERE>/subscribed_apps?access_token=<TOKEN_PASTED_FROM_GRAPH_API_EXPLORER>'
{"success":true}
With the Facebook Access token debugger (info icon on the left of the access token, then open in Access token tool), it is confirmed that the token knows about both the page and the app that have to be connected.
The question is, how are these page-app related token programmatically produced? I can't seem to find the proper API call in Facebook documentation and it is by all means possible, as Chatfuel and Manychat are doing this.
Thanks in advance for your support Lars Schwarz and community!
Adding some detail to Alex's answer, for it to be more complete.
When subscribing an app to a page, Facebook needs to:
Know what app you are talking about.
Know what page you are talking about.
Know that you have permissions on that page to subscribe an app.
How does Facebook know it all?
1 comes from the fact that Facebook login happens in the context of a page, actually, the Javascript code for Facebook contains your appId:
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0&appId=<YOUR_APP_ID_IS_HERE>&autoLogAppEvents=1';
2 Comes from the page_id in the URL used to subscribe apps to pages:
https://graph.facebook.com/v3.0/YOUR_APP_ID_HERE/subscribed_apps?access_token=YOUR_ACCESS_TOKEN_HERE
3 Comes from the access token, obtained in the context of an APP through Facebook login, that is passed as parameter in the URL used to subscribe apps to pages:
https://graph.facebook.com/v3.0/YOUR_APP_ID_HERE/subscribed_apps?access_token=YOUR_ACCESS_TOKEN_HERE
To do this, you need to put FB Login on your site/customer portal and request pages_messaging and manage_pages permissions. The person that logs in must be a Page Admin.
Once your app has been granted that permission for the page, you can generate a page access token as described here:
https://developers.facebook.com/docs/pages/access-tokens

Facebook ads authorisation

My application use facebook authentication to ask the user permissions to manage his ads. i use the following scope:'public_profile,ads_management,ads_management'
but in the login window it shows only public profile which will an invalid access token for the ads management.
have a look at this answer https://stackoverflow.com/a/25901780/5410373
the ads_management extended permission is only granted to whitelisted apps. So if the Graph endpoint you're hitting requires that permission then you'll have to get your app approved. Check out the getting started overview https://developers.facebook.com/docs/reference/ads-api/overview
and this answer : https://stackoverflow.com/a/24753070/5410373
All permissions except
public_profile
user_friends
email
require a review of your app by Facebook before you can use them publically. See https://developers.facebook.com/docs/apps/review/login#do-you-need-review