是否可以从特定用户那里获取消息?
如果我想收到所有收件人都是我自己和x
的邮件我没有找到创建这种查询的方法,所以有可能吗?
答案 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
});
facebook facebook-fql facebook-api facebook-graph-api facebook-fql-query
答案 1 :(得分:0)
现在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)
但它也不起作用并返回空数据......