My organisation recently started using folders on their Facebook page. The conversations then can be categorized as Inbox, Unread, Follow Up, Done and Spam.
I regularly download the messages via Graph API and everything worked fine when they kept all the conversations in the Inbox. However recently they categorized the conversations, so the inbox has only 7 elements at the moment, 0 elements in the Unread and Follow Up and countless elements in the Done and Spam folders.
I used the following query before:
me/conversations?fields=updated_time,messages.limit(100){message,from,created_time}&limit=100
Now it only returns the elements from the inbox.
The Graph API reference vaguely describes parameters like folder and tags. I tried to use the folder parameter like:
me/conversations?folder=done
me/conversations?folder=unread
me/conversations?folder=randomstring
It all the time returned the same 7 elements from the inbox.
However, if I query me/conversations?folder=spam
it returns 10 different elements, which does not overlap with the actual “Spam” folder and contains elements marked as “Done”. (They are quite fishy conversations, so they might have been marked as spam and there might be two different definitions of being spam as marked as spam or being in the spam folder, I don’t know.)
The API reference does not specify how to actually use the folder and the tags parameter and does not say anything how to query messages in the other folders.
Any idea how to access the conversations in the other folders? It’s fine for me to query the folders one-by-one or to query from all folders as well.
3
Answers
After investigating this endpoint, I think
?folders
is some ancient param before the rework of the messaging from messages in folders to conversations to pages. If I query my page for the spam folder, I never get messages listed, even though I flagged some with spam. And while they are flagged with spam, I do not get those on the conversations query (without folder=spam).I believe, facebook changed the system into
tags
on conversations. You can get those like so:[page_id]/conversations?fields=participants,messages{tags,message}&folder=sent
.Note: The marked “no sent tag” is not related to the folder applied (as they dont work). Maybe the tagging on conversations is the reason you get the same result from querying threads at
[page_id]?fields=threads{participants,messages{tags,message}}
So for now I think, one has to get over everthing there to read the inbox. Yet I am a bit sad about not getting flagged spam messages from the graph. I will investigate this a bit further later^^
The documentation might need some updating. But for now, I can query messages in “DONE” via:
Call folder=page_done with Page Access Token to retrieve all threads/messages in Done folder of Page inbox.
To get Page Access Token