Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get messages for specific user by FQL or GRAPH API?

I would like to retrieve all messages from https://graph.facebook.com/me/inbox or via FQL for specific user like: "All messages from and to user with ID: 123456789"

I will be possible with FQL multi-query ?

like image 606
Radovan Stas Avatar asked Feb 07 '12 23:02

Radovan Stas


2 Answers

var fbid = your_fbuid_here;
    FB.api({
                method: 'fql.query',
                query: 'SELECT thread_id, author_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND author_id = ' + fbid + ' ORDER BY created_time ASC LIMIT 1'
            }, function ( threadresponse ) {
                FB.api({
                    method: 'fql.query',
                    query: 'SELECT thread_id, body, author_id, created_time FROM message WHERE thread_id = ' + threadresponse[0].thread_id + ' ORDER BY created_time ASC'
                }, function ( inboxresponse ) {
                        //do stuff here with results
                });
            });

facebookfacebook-fqlfacebook-apifacebook-graph-apifacebook-fql-query

like image 194
Damien Keitel Avatar answered Sep 29 '22 02:09

Damien Keitel


I will be possible with FQL multi-query ?

Yes it is possible when the inbox belongs to an authenticated app user with the appropriate permissions granted.

like image 43
DMCS Avatar answered Sep 29 '22 01:09

DMCS