I'm really stuck on this matter.
I've been reading the documentation over and over and I don't understand how to use the access token for my page, so that I could pull the page's messages.
This is my code:
$user_id = $facebook->getUser();
if($user_id) {
$user_profile = $facebook->api('/me/accounts', 'GET');
}
and then I get an array, with two keys: data
and paging
Inside of data
I get an array of the pages I own, where the access_token is available for each page.
According to this page:
https://developers.facebook.com/docs/graph-api/reference/page
I should be able to access my page's inbox by calling the edge:
/{page_id}/conversations
but when I do it this way:
$facebook->api($page_id.'/conversations', 'GET');
The FacebookApiException is thrown with the message:
(#10) Application does not have permission for this action
but I'm sure I've permission for that action. I'm sure it has something to do with the access token, but I just don't know what to do with it.
What am I missing? How do I use my page's access token to read my inbox?
Thanks!
Can you try
And before calling the API do something like
The above should solve the access token issue. However as replied by Shankar Damodaran you may check his steps as well.
Also In addition you can try to remove the APP from your profile and try to do a connect and retry giving permissions and see if this resolves the issue