Read Messages in Facebook

I have been trying to read the messages from a particular user (friend).

I couldn’t find a proper documentation in graph API regarding querying messages or threads in Facebook messages.

Can anyone please help me?

Answers


You can only read messages for the user using your app, not for his friends. (And that’s a good thing …)

For doing it for the current user, see here: https://developers.facebook.com/docs/reference/api/user/ (inbox & outbox connections)


It's currently hard to do it because you have to pull the full response from me/inbox

If you know the thread id beforehand you can maybe get it but /thread_id doesn't seem to be working well.

So to currently get it, check for the friend id in the to field within the response of each thread object.


you can use it like this:

https://graph.facebook.com/fql?q=select thread_id,subject,recipients, snippet, snippet_author from thread where folder_id = 0 and [FRIEND_ID] in recipients

Then you get all threads where your friend is. Then you can check from those threads that thread where only you and this friend are the recipients.

And then you can get the messages using:

https://graph.facebook.com/fql?q=SELECT message_id, thread_id, author_id, body, created_time, attachment, viewer_id FROM message WHERE thread_id = [THREAD_ID]

Need Your Help

How can I edit a value of User without signing the User out?

ruby-on-rails ruby-on-rails-3 session session-variables session-cookies

I would like to add a column to users called points, and update it at different times. However, when I change a value of a User column, the User is signed out, since the remember token for the user...

How to [en|de]crypt XML using Xamarin.iOS?

c# encryption xamarin.ios xamarin xml-encryption

I want to encrypt/decrypt some XML using Xamarin.iOS.