Last week I requested an app review with Facebook, which has successfully granted me permission to request "read_page_mailboxes" permission for users of my application.
I now have an extended access token which, according to the Graph Explorer tool has properties:
App {app_id}: SAM :. Thinkka
User {user id}: James Hartnoll
Valid: True Scopes read_page_mailboxes, manage_pages, publish_pages, business_management, public_profile
I am trying to read conversations of a business page, using this URL:
https://graph.facebook.com/v2.7/[Page_Id]/conversations?fields=can_reply,id,unread_count,updated_time,subject,snippet,link&access_token=[access_token]
However, when I make the request, the response is:
{
"error": {
"message": "(#298) Requires extended permission: read_mailbox",
"type": "OAuthException",
"code": 298,
"fbtrace_id": "FEHvo/6+z39"
}
}
Now according to the Facebook documentation, here:
https://developers.facebook.com/docs/graph-api/reference/v2.7/page/conversations
I have all the permissions I need (namely read_page_mailboxes).
I have done some research and this question (not mine) on Stack Overflow, sums up fairly well what I am doing.
One answer suggests to try using https://graph.facebook.com/v2.7/me/conversations.... but that results in the same error, and the other answer suggests that read_page_mailboxes need approving.
That permission has been approved though, see the start of this question!
The Facebook change log here: https://developers.facebook.com/docs/apps/changelog#v2_4
Tells me that read_mailbox is deprecated, and reading further into that permission, it seems it would not have been granted anyway according to the App Review request, that permission is not available for Web applications anyway.
So... I am stuck?! I have all the permissions that I am required to have according to the documentation, my token is valid and my "GET" requests are correct, but I need a permission which was deprecated a year ago?!
I've sent this message to Facebook too, but it'll take a few days for them to reply and it's irritating me as this should work apparently!
Anyone here had any experience/solution with this?
**NOTE: ** I am after Business Page messages, NOT, personal ones - for clarity.
You're not using page access token to request,instead you're using user access token.You need to first get page access token via GET /me/accounts or visit getting page access token for more details on that.
Once You have this token you can read page conversation by using the following method in PHP:
$pagemessages = file_get_contents('https://graph.facebook.com/me/conversations?access_token={page-access-token}');
var_dump($pagemessages);
or simply using GET request to above link.
Thanks!
Related
I have an app-scoped user id (ASUID) for a Facebook user and I wish to obtain a link to that user's profile page.
A post on Facebook's Developer blog dated May 1, 2018 states that this link is accessible as of Graph API v3.0 through the link field on a user object. Access to this field requires the user_link permission be approved for the app and granted by the app user.
I have attempted to access this field with a user access token associated with my test app and I have verified the access token has the user_link permission granted via the Access Token Debugger. However, the link is not included in the response.
Request:
https://graph.facebook.com/v3.0/[ASUID]?fields=link&access_token=[ACCESS_TOKEN_W_USER_LINK_PERMISSION]
Response:
{ "id": "[ASUID]" }
Is there any indication as to why this is not working?
As documented, the user_link permission requires an App Review pass before it's available to live apps.
At time of writing this answer there is no way to get user profile page using Facebook API.
I am building my first facebook app and am facing a issue.
Task : Build a entirely server side application to be used by the admin of a facebook page to post videos/photos on the page. This should not involve having the admin to log in everytime to generate the user acess and page access token.
What I found : Based on the requirement, I found that app tokens can be used for this purpose. This line specifically hints at the usefulness.
App access tokens can also be used to publish content to Facebook on behalf of a person who has granted an open graph publishing permission to your application
I think that using this will be safe since mine is an entirely server side app.
Problem The docs say that:
GET /oauth/access_token?
client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
will give the app token that can be used in place of user access token.
However, I have not been able to do so. Specifically the error encountered is
Error 200 .The user must have accepted the TOS. Since I have already tried publishing content with page access token, I know this is a permission issue.
The following line
a person who has granted an open graph publishing permission to your application.
does not clarify everything. I came across a related question, but the answers seem to be a bit vague.
It would be really great if someone could give me insights about how this can be achieved.
In order to post to a page, you need at least authorize with the manage_pages permission. If you want to post "as user", you need to add publish_actions and use a "User Access Token". If you want to post "as page", you need to add publish_pages and use a "Page Access Token".
Information about how to generate those Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
The error message with the TOS has been discussed a lot of times already, please go to those threads (or find a lot more with the search function):
(OAuthException) (#200) User must have accepted TOS on C# - Facebook
How come I get a "must have accepted TOS" error for test users with app installed?
facebook long term token "(#200) User must have accepted TOS"
Occassional (OAuthException - #200) (#200) User must have accepted TOS
You cannot post to a Page via an App Access Token. This is clearly stated in the docs at
https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed#publish
A user access token with publish_actions permission can be used to publish new posts on behalf of that person. Posts will appear in the voice of the user.
A page access token with publish_pages permission can be used to publish new posts on behalf of that page. Posts will appear in the voice of the page.
I'd recommend to use a eternal Page Acess Token, so there's no obligation to renew the User Access Token. Have a look at my answer here:
Post to a facebook page without "manage_pages" permission using php
See
https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens
I have a really weird situation here, and I've looked everywhere through Facebook's documentation with no answers.
I'm trying to get get recent posts from multiple Facebook pages. But one of them keeps crashing. It won't work when I'm using an app token. It works if I'm using access tokens, but those expire, so it'd be better to not use that.
https://graph.facebook.com/norgeshushonefoss/posts?access_token=myAppToken
gives this result:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
While this url gives me the recent posts: https://graph.facebook.com/norgeshus/posts?access_token=myAppToken
I can't see any difference in those two. Are there any page settings that may cause an app token not to authorize for some reason?
If the page has any access restrictions in place (age, location, alcohol-related content), then you can not access any of its info using your app access token.
It needs a user access token for a user that qualifies to see the page (or a page access token).
I've developed a Facebookapp that has the "user_photos" permission. Now i've submitted the App, which is now live. I've installed it on several Facebook-Accounts of my friends... (Yes! they have granted the requested permissions)
When i now try to make an request i get the following error message
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
Here's my Request-Query:
https://graph.facebook.com/LogInIDOfMyFriendThatHasInstalledTheAPP/?fields=albums.fields(photos,name,description),email&access_token=mySecretAppToken
Ok it works if I replace the App-Token with a User-Token that is generated by an OAuth-Process or via GraphAPIExplorer but in the Documentation (https://developers.facebook.com/docs/facebook-login/access-tokens/) it is said (in Paragraph) "App Tokens" that
"App access tokens are used to make requests to Facebook APIs on behalf of an app rather than a user. [...]" and that i have to generate an other "App Accesstoken" but this also does't work.
I'm confused...
So is there something i've forgotten / missunderstood or do I have to use the oAuth-Way which means that my friends have to reauthenticate to my App every two month???
Thanks a lot!
Best regards
Mike
A few lines after in the documentation it states
App access tokens can also be used to publish content to Facebook on behalf of a person who has granted a publishing permission to your application.
This is what they mean by requests on behalf of the user.
For the albums endpoint you need a user access token.
Yes your friends need to re-authenticate your app every two months if you extend a short lived user access token. The point is not to have apps sitting around with access when the user may have forgotten them. Prompting the user to re-authenticate ensures they are still aware of these apps and can have the choice to keep or delete them
I am getting this error while trying to access Facebook Graph api mailbox
https://graph.facebook.com/me/inbox?access_token=<access_token>
"error": {
"type": "OAuthException",
"message": "mailbox requires the read_mailbox extended permission."
The access token is valid.. But any hints on the permissions and where I am going wrong..
First, on logging in to Fb, it gives me a code and then access_token
Thanks for your help.
This is outdated, with the latest release(current version 2.6), you can't access private messages.
You need to grant your application the read_mailbox permission.
https://developers.facebook.com/docs/authentication/permissions/
Information on how you do that can be found here:
https://developers.facebook.com/docs/authentication/
At this time it is not possible to use the instagram API without an application authorization. The tutorials that teach how to use it through a token generated by the graph api do not work. For the application, you will first need to send some documents from your company, wait for validation, and then send advanced resource requests