3

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?

Pablo Claus
  • 5,886
  • 3
  • 29
  • 38
siva
  • 1,429
  • 3
  • 26
  • 47

3 Answers3

1

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)

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • @CCBroe i came to understand your answer, after a little amount of research !!! Thanks.. – siva Jul 24 '12 at 18:12
0

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.

phwd
  • 19,975
  • 5
  • 50
  • 78
  • thanks for ur response.but i need some more inputs to understand it. i'm unable to interpret the response of `me/inbox` – siva Jul 15 '12 at 06:57
0

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]
Juuso Kosonen
  • 216
  • 3
  • 10