Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query conversations by folder via Graph Api?

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.

like image 531
szedjani Avatar asked Dec 07 '17 01:12

szedjani


People also ask

Is Graph API RESTful?

While this is called the Graph API, it is actually a REST API.

What can you do with graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.


1 Answers

The documentation might need some updating. But for now, I can query messages in "DONE" via:

/{page-id}/conversations?tags=action:archived
like image 90
DON'TPANIC Avatar answered Sep 17 '22 22:09

DON'TPANIC