Reputation: 81
I wanted to get facebook's messages not Feeds. I've searched about it but did not find the solution.
I have also looked into FQL for the same but didn't find any useful things.
Is it possible to get messages from facebook with specific date ? OR just messages ?
Upvotes: 1
Views: 20129
Reputation: 7813
It's possible you get lastest facebook messages on top of thread(conversation session) by specific time with fql API, such as
SELECT snippet, recent_authors, updated_time FROM thread WHERE folder_id = 0 AND updated_time=1364564697
Also, it's possible you get facebook message by specific time with API within thread. Such as
SELECT body, created_time FROM message WHERE thread_id=1774741570083 AND created_time=1348806942
For your question. Yes. It's possible get facebook message from ALL inbox messages by specific DATE(by DATE, not by TIME, as your request). Example, get all inbox messages from "Thu Aug 23 2012 00:00:00 GMT+0800 (MYT)" to "Fri Aug 24 2012 00:00:00 GMT+0800 (MYT)"
SELECT body, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND (created_time>=1345651200 AND created_time<1345737600)
Update:
To retrieve sender name and profile photo, you can do
{"query1":"SELECT author_id, body, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND (created_time>=1345651200 AND created_time<1345737600)","query2":"SELECT id, name, pic_square FROM profile WHERE id IN (SELECT author_id FROM #query1)"}
Update: HTTP GET request example, quote the fql query, append to
https://graph.facebook.com/fql?format=json&q=
After that, append &access_token=YOUR_USER_ACCESS_TOKEN at the end:
Upvotes: 4