【问题标题】:Is there a way to get messages from specific user有没有办法从特定用户那里获取消息
【发布时间】:2012-02-12 11:42:02
【问题描述】:

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

如果我想获取收件人是我自己和 x 的所有邮件

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

【问题讨论】:

  • 那么有可能以某种方式获得该线程吗?

标签: facebook message inbox


【解决方案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
                    }); 

【讨论】:

  • 嗯,这会返回我的第一个线程,这不是我要找的。​​span>
  • your_fbuid 是您要匹配消息的人之一。第一个查询是从线程fql中获取thread_id,第二个fql是获取所有消息。
  • 好吧,我也可以成为消息线程中的作者,所以这不起作用。
【解决方案2】:

现在 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)

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

【讨论】:

    猜你喜欢
    • 2021-04-17
    • 2016-06-27
    • 2012-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-30
    • 1970-01-01
    • 2020-12-30
    相关资源
    最近更新 更多