FQL query to receive chat

Here is the code. As a result, I want to see my conversation and a conversation with a friend. For conversation history functionality How to do this?

SELECT message_id, thread_id, author_id, body, created_time, viewer_id FROM message WHERE thread_id IN (SELECT thread_id, subject, recipients FROM thread WHERE folder_id =0 ) AND author_id = 'xxxxxxxxxxxxxxx' ORDER BY created_time DESC LIMIT 0,25 

This code only returns my friend’s data.

+4
source share
2 answers

You have limited the comments returned to those created only by your friend.

Change

 AND author_id = FRIEND_ID 

to

 AND (author_id = FRIEND_ID OR author_id = me()) 

in the WHERE clause of your request.

0
source

Get thread_id using the original query, and then try this fql query. I think thread_id belongs to the whole chain

 SELECT message_id, thread_id,source,author_id,body,created_time,viewer_id FROM message WHERE thread_id=THREAD_id AND (author_id=FRIEND_ID OR author_id=me() ) ORDER BY created_time DESC LIMIT 0,25 
0
source

All Articles