7

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 ?

Radovan Stas
  • 71
  • 1
  • 3

2 Answers2

3
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
                });
            });

Damien Keitel
  • 786
  • 1
  • 5
  • 12
  • 1
    First query will select only threads authored with friend's uid user. If the thread was authored by the current user, there will be no results. – vian Mar 12 '13 at 06:54
  • hey, I was wondering if there's a new better way to to this? This only returns messages authored by the friend. – Jürgen Paul Apr 01 '14 at 14:23
1

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.

DMCS
  • 31,720
  • 14
  • 71
  • 104