While working with the Facebook Workplace API liking an object (post, comment, photo..etc) can be done by passing the Admin Access Token, I'm trying to figure out how to do it on behalf on the user for a feed / comment posted into a group.
The docs mention getting the Page Access Token to perform this action but a Group doesn't have an Access Token & doesn't really solve what I'm going for anyway.
I've tried getting the User Impersonation Token from the API using the Admin Token but posting to the likes graph endpoint results in a publishing error.
POST /https://graph.facebook.com/{COMMENT-ID or POST-ID}/likes
HEADERS: Authorization Bearer "{IMPERSONATION-TOKEN}"
Error Response:
{
"error": {
"message": "(#3) Publishing likes through the API is only available for page access tokens",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "CGpXtFWrwiA"
}
}
Again this works fine using the Admin App Access Token but not on behalf of the user. Also a group doesn't have an access token unlike a regular FB Page.
Any help on this would be great!
Related
I'm trying to use this endpoint from the Instagram graph api:
GET /ig_hashtag_search?user_id={user-id}&q={q}
Documentation for this endpoint can be found here.
I'm running this GET request:
https://graph.facebook.com/v14.0/ig_hashtag_search?q=coke&transport=cors&user_id=<my_user_id>&access_token=<my_access_token>&q=coke
and get this as response:
{
"error": {
"message": "(#200) Requires instagram_basic permission to manage the object",
"type": "OAuthException",
"code": 200,
}
}.
The user id comes from my instagram account and the access_token that I'm using is a User token generated with "Graph API explorer" and I can see that this token has the scope "instagram_basic" when using the "Access Token Debugger".
I can't understand why this does not work? Do I really need to submit a API review just to test the hashtag endpoint during development?
Please help!
I guess sometimes App review team of Facebook doesn't know what is the usage of the permission so they just decline the submissions randomly. I got that permission like 3 months ago and i checked my app review. I send them this text
We are going to use instagram_basic to read an Instagram account profile's info and media. We will get the basic metadata of an Instagram Business account profile like "USERNAME", "ID", "FOLLOWERS", "FOLLOWING". You can check the Screescast to see how we use the instagram_basic on our app.
Here is what they saw while they do the app review
Also be careful while you send requests, keep in mind to change it to development mode. Some of the endpoints works only in live mode. The API still changes a lot and there are tons of bugs i see in my project. I hope this helps.
I have a user access token for our App that expires in 60 days, but we have about 30 pages under this App. I know there is a way to create a permanent token for each Page, but is there a way to create a permanent token for the App?
Also I know I can generate an App access token here:
curl -X GET "https://graph.facebook.com/oauth/access_token
?client_id={your-app-id}
&client_secret={your-app-secret}
&grant_type=client_credentials"
but when I try to make a request for /me/accounts in the GraphAPI I see the error:
{
"error": {
"message": "An active access token must be used to query
information about the current user.",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "Ab7EmJxQqOjyA5dLz71Cokb"
}
}
So I think I need to stick to a user access token, but I need to find a permanent one
I'm trying to list the Ads for a Facebook Page using the Graph API /{page-id}/ads_posts endpoint, but I get a permissions when I try to.
Using the Graph API Explorer, I generate an Page Access Token with those permissions: email, read_insights, manages_pages, pages_show_list, ads_read, business_management, instagram_basic, instagram_manage_insights and public_profile.
I'm an admin on the Page itself, the attached Business Manager and on the corresponding Ad Account.
Every time I try to call the /{page-id}/ads_posts, I receive
{
"error": {
"message": "(#200) Not enough permission to call this endpoint",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "XXXXX"
}
}
I can't find any help on the Facebook documentation or Google, given that the error isn't really meaningful (in some cases, I get a message saying that a specific permissions is missing, but not here). Anyone can help ?
EDIT: I tried to add the ads_management permission too, without success.
You need to add those pages to your app that is in development mode (https://www.facebook.com/settings?tab=business_tools).
I am working on Instagram API integration to our service. As of 3.6.2019, I have tried to get media for a particular Instagram user account. I have tried to understand the documentation, and this is what I have working so far:
I have an Instagram business account
I did attach my Instagram account to my business page by logging in
I have obtained a page and a user access token via Graph API Explorer. User token has the following permissions:
email
instagram_basic
manage_pages
pages_show_list
pages_messaging
public_profile
I am able to get information about the associated Instagram account like profile_pic and username.
What perplexes me about this is that when I read the documentation, user info retrieval seems to work alright:
However, if I changed the URL to match the media retrieval URL and keeping the same user ID, I get the following error
even through the documentation says:
To get all media objects on an Instagram Business User, send a GET request to the User's /media edge.
And the sample request URL provided:
GET graph.facebook.com/17841405822304914/media
Source: https://developers.facebook.com/docs/instagram-api/reference/user/media/
What am I doing wrong? The URL seems to follow the documentation description. I did use the user access token for the media request. The access token contains permission for instagram_basic, as needed based on the documentation:
Permissions
An access token from the Instagram Business User, with the following
permissions:
instagram_basic
I am using API version 3.2.
Do you really use the right instagram id? Try calling this API with the ID you used:
https://graph.facebook.com/v5.0/[ENTER_ID]?fields=instagram_business_account{id, username,profile_picture_url}&access_token={}
I you get a result like this:
{
"instagram_business_account": {
"id": "XXXXXXX",
"username": "XXXX",
"profile_picture_url": "https://scontent.xx.fbcdn.net/v/t51.2885-15/44644278_733652060347074_11957"
},
"id": "XXXXXXX"
}
You know, that you used the wrong ID :D
Go ahead and call the /media endpoint with the ID nested under instagram_business_account
We have a company-owned web application that should post to our company-owned facebook page.
should be a server-to-server call
the user in our webapplication who makes the post in the webapplication gui, should ideally not have to be a facebook admin for the facebook page.
We have a facebook App that is added to a testpage on facebook, and when I do this API call:
https://graph.facebook.com/PAGE-ID/feed?message=MESSAGE-CONTENT&access_token=APP-ID|APP-SECRET
..the answer I get back is:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "TRACE-ID"
}
}
It seems like I need the publish_pages right, and this right require an App-review (unless users are known and assigned roles in the app), but it says in the review info from facebook, that automatically publishing is not allowed for this right.
We can save a token in database and reuse when posting to Facebook Graph API.
Is this impossible without a facebook user doing a Facebook login in our webapplication?
Should we instead get a long-lived user token from a facebook-page-administrator, and then reuse this when posting, and re-login to facebook client side, before token expire?