facebookfacebook-graph-apifilterfacebook-messages

Facebook graph API to retrieve messages sent to/from a friend


Facebook graph API allows to retrieve chat messages using "GET /me/outbox". Is there any way to retrieve the messages sent to/from a friend using graph API modifiers rather than parsing the entire array of messages.


Solution

  • Using fql, just change the FRIEND_USER_ID:

    SELECT author_id, body, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 1 AND 'FRIEND_USER_ID' IN (recipients))
    

    You can test with graph API explorer.