Jamie Hartnoll
Jamie Hartnoll

Reputation: 7361

Cannot read Business Page messages with Facebook Graph API despite appropriate permissions

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.

Upvotes: 1

Views: 804

Answers (1)

Farri.K
Farri.K

Reputation: 26

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!

Upvotes: 1

Related Questions