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
Related
I am trying to access Instagram messages from the Facebook Graph API Explorer.
With v14.0 I make the GET call me/conversations?platform=instagram. I get the following error:
"error": {
"message": "(#298) Reading mailbox messages requires the extended permission read_mailbox",
"type": "OAuthException",
"code": 298,
"fbtrace_id": "Ad8l_IyomTnyotlNMG_HiS8"
}
}
However, there is no read_mailbox permission in the Graph API Explorer Permissions. I checked under App Review > Permissions and Features, and couldn't find the read_mailbox permission there either.
Note that this API call works in the video https://www.youtube.com/watch?v=Pi2KxYeGMXo&t=18s, where they are using API v12.0, and the read_mailbox permission isn't required for that.
How do I get the read_mailbox permission or work around it?
"message": "(#298) Reading mailbox messages requires the extended permission read_mailbox",
That permission existed in the early days of the API, when it was still possible to read the mailbox of a user account.
Since you are getting that message here, this indicates that you tried to use a user access token, instead of a page token. (What the alias me resolves to, depends on the access token.)
I am trying to connect a bot to Facebook messenger, using Facebook developer tools.
https://developers.facebook.com/
I've created the Facebook app, and it's sent me the webhook to my server. However, when trying to call the Graph API when sending a message back to the user, I receive the following error:
FacebookMessaging:400 : {
"error": {
"message": "(#2) Service temporarily unavailable",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AIWsRyUmPFnySGwb1Rgl4P6"
}
}
POST API,
https://graph.facebook.com/v10.0/page-id/messages?access_token=token
JSON
{recipient:{id:"id"}, message:{ text:"message"}}
I suspect it could be because my app is unreleased, but I'm trying to test it beforehand. Is there any other explanation for this, or how are you suppose to test an app before releasing it?
The same code is working for an older Facebook app that is released.
The issue was that the API call was missing the access token. Stupid mistake, but unusual error for missing the access token.
I already try and reproduce this problem. May be you use wrong access_token in this case. When you want to send the message by page, use should use page access token instead of user access token
Check out the diff here: https://developers.facebook.com/docs/facebook-login/access-tokens/
And flow here for get page access token: https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
It is clearly return you the response with type as OAuthException. If you find this error type in facebook garph api error handling documentation. You can see the first line of error codes is OAuthException. Also it is written there the resolution of this type of error in what to do column is, If no subcode is present, the login status or access token has expired, been revoked, or is otherwise invalid. Get a new access token.
If a subcode is present, see the subcode.
Well it is nice to see you get the answer on your own.
I am trying to pull Facebook Ads metrics through the Facebook Marketing API. The flow is basically that I wish to pull all the account ids of my company, and then loop over them, retrieving the insights for them individually.
However I have an error which I am not able to solve/comprehend.
When I attempt to make the API call (both in the Graph Explorer and my Alteryx workflow):
GET-> /v2.8/act_<Account_ID>/insights
I get the following error:
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "BNevVWUExDg"
}
I must admit that I am quite at a loss what is causing this error...and actually also exactly what the issue is...am I lacking the right scope/permissions for my token?
With the same token I am able to correctly call the API to get a list of all adaccounts (GET-> /v2.8/me/adaccounts ).
Anyone have an idea what my issue might be?
You have to make sure that your particular access token has the permissions ads_management or ads_read.
This is from the Marketing API quickstart. https://developers.facebook.com/docs/marketing-apis
There are also rate limits on those API's, but I would expect a different error if that was the case.
I ran a POST instead of GET on the same endpoints, which gives me another error about not being admin on the account.
It appears that the user associated with the token (which is a long lived one) was only having analyst access to the account in Business Manager. After I changed it to advertiser it seems I can do the GET call.
In my case, I added a new development user in the roles page. Then I was trying to do OAuth. I got the error message "Application does not have the capability to make this API call."
Here's the way that I solve the problem while your application still in the development mode.
Go to Marketing API > Tools
Then select what token permissions you want. Press "Get Token" button.
Now, you can try to do OAuth again.
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!
I'm trying to access Facebook insights payments_daily_spend with the API with this url:
https://graph.facebook.com/v2.1/APPID/app_insights/payments_daily_spend?since=1403506800&until=1412146800&summary=true&date_format=U&access_token=ACCESSTOKEN
but all I'm getting back is
{
"error": {
"message": "(#3003) Metric requires app admin privileges",
"type": "OAuthException",
"code": 3003
}
}
The app access token I'm using was gotten with an account that has admin privileges for the app, and I can't seem to find any reference to this error anywhere. Has anyone seen this before or know what's wrong?
I finally got an answer by submitting a ticket to Facebook. You need an access token with the read_insights extended permission. You can get it from the Graph API Explorer, but there's probably an API call for getting such a token.