有没有办法从特定用户获取消息

时间:2012-02-12 11:42:02

标签: facebook message inbox

是否可以从特定用户那里获取消息?

如果我想收到所有收件人都是我自己和x

的邮件

我没有找到创建这种查询的方法,所以有可能吗?

2 个答案:

答案 0 :(得分:1)

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

或者你可以这样做

 var fbid =the _freind_fb_uid_here;          
            FB.api({
                        method: 'fql.query',
                        query: 'SELECT thread_id, body, 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 DESC'
                    }, function ( threadresponse ) {
                                //do stuff here with results
                    }); 

答案 1 :(得分:0)

现在FQL没有字段author_id,只有originatorsnippet_author。但是这个字段包含错误的数据。例如,userA发送给我(userB)消息:userA创建线程。无论如何,我看到,发起人有我(userB)。

使用recipients的最佳方式:

SELECT recipients,snippet,object_id,updated_time,unread,unseen,thread_id FROM thread WHERE folder_id=0 AND recipients IN (userA_fid, userB_fid)

但它也不起作用并返回空数据......