Read Messages in Facebook

a 夏天 提交于 2020-01-04 02:32:06

问题


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?


回答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)




回答2:


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.




回答3:


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]


来源:https://stackoverflow.com/questions/11486995/read-messages-in-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!