【发布时间】:2012-02-12 11:42:02
【问题描述】:
是否可以从特定用户那里获取消息?
如果我想获取收件人是我自己和 x 的所有邮件
我没有找到创建这种查询的方法,有可能吗?
【问题讨论】:
-
那么有可能以某种方式获得该线程吗?
是否可以从特定用户那里获取消息?
如果我想获取收件人是我自己和 x 的所有邮件
我没有找到创建这种查询的方法,有可能吗?
【问题讨论】:
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
});
facebookfacebook-fqlfacebook-apifacebook-graph-apifacebook-fql-query
【讨论】:
现在 FQL 没有字段 author_id,只有 originator 和 snippet_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)
但它也不起作用并返回空数据......
【讨论】: