Search code examples
node.jsfacebook-graph-apifacebook-page

Permission issue on /{page-id}/conversations with Facebook Graph API


I'm working with Facebook Graph API and can't figure out why I can't accept the following route : /{page-id}/conversations

When I do I receive the following error : (#283) Requires extended permission: manage_pages

Here is the way I get my token :

First I get an acces_token for the user using the usual login, I ask for ['read_page_mailboxes', 'manage_pages']as permissions.

With this access token I call /me/accounts to get the list of pages for this user. In my case the user only have a single page, from this page I take the ID and access_token.

Being able to retrieve an access_token for the page means thaht the manage_pages permission is indeed granted.

Then I try to call /{page-id}/conversations with the page access_token and I face the error mentioned earlier.

Here is a snippet for node.js which is basically what I do in my app in a single function :

  var options = {
    url: getFbUrl('/me/accounts'),
    qs: { // Query string parameters 
      access_token: userAccessToken,
    },
    method: 'GET'
  };

  request(options, function (err, response, body) {
    if (err)
      return done(err);

    body = JSON.parse(body);

    var pageAccessToken = body.data[0].access_token,
        pageId = body.data[0].id;

    var pageOptions = {
      url: getFbUrl('/' + pageId + '/conversations'),
      qs: {
        access_token: pageAccessToken
      },
      method: 'GET'
    };

    request(pageOptions, function (err, response, body) {
      if (err)
        return done(err);

      console.log(response.statusCode);
      console.log('PAGE BODY', body);

      done();
    });
  });

I've been stuck on this for way longer than I'd like, any help or tips appreciated.

Have a nice day.


Solution

  • It's a reported bug and here is the link: https://developers.facebook.com/bugs/380833342117530/