Question

I want to search facebook messages content using the graph API

https://graph.facebook.com/me/threads?access_token=ACCESS_TOKEN

This one returns my facebook inbox messages, Is it possible to search for a specific word in those messages using the API itself without server side filtering ?, Just like how it works in the actual inbox, search feature lets me search in the message contents

Lets say this is a message : " I love StackOverFlow users ! "

I want to use something like this to only return it

https://graph.facebook.com/me/threads?access_token=ACCESS_TOKEN&contains=stackoverflow
Was it helpful?

Solution

Use fql, example of search 'hi':

SELECT author_id, body, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND CONTAINS("hi")

Test with Graph API explorer:

https://developers.facebook.com/tools/explorer?fql=SELECT%20author_id%2C%20body%2C%20created_time%20FROM%20message%20WHERE%20thread_id%20IN%20(SELECT%20thread_id%20FROM%20thread%20WHERE%20folder_id%20%3D%200)%20AND%20CONTAINS(%22hi%22)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top