I’m trying to pull the ‘unread’ messages from our Facebook Page (as opposed to an individual user’s page. I’m trying to use FQL to pull the data;
SELECT folder_id, viewer_id, name, unread_count, total_count
FROM mailbox_folder
WHERE folder_id = '0' and viewer_id = '$pageID'
$pageID is the ID of the page.
I have manage_pages permissions on the user’s account, and that account is an administrator for the page. Since it is a new feature from facebook to allow messages direct to pages, I am wondering if it’s not yet possible to obtain this information via FQL.
I get an error message which says;
(#606) You can only fetch messages for one user
When I look up for permissions (manage pages, publish stream and read_mailbox) for the page, as opposed to the user, the following is returned;
"manage_pages": 0,
"publish_stream": 1,
"read_mailbox": 0
I don’t know I can request the read_mailbox permission from the page as oppose to the user. Does anyone have any idea how I might achieve the above?
See this document which shows how to obtain a page access token – https://developers.facebook.com/docs/authentication/pages/
Summary: get
manage_pagespermission from the page admin and obtain the page access token from/USER_ID/accountsAlso, here: https://developers.facebook.com/docs/reference/api/page (see ‘Mailbox’ – shows how to read the mailbox in the Graph API – it should be applicable in FQL too)