Is there a way to get the ID of a message thread in Facebook? [closed]

时间秒杀一切 提交于 2020-01-02 07:40:30

问题


If I have the URL of a facebook thread from a user's messages, is there a way to get the id of that thread? I get how to construct a url given an id, but not the other way around.

The URL can have two formats:

https://www.facebook.com/messages/123456789 or https://www.facebook.com/messages/<username>

I need to be able to handle both cases.

Thanks.


回答1:


SELECT thread_fbid 
  FROM unified_thread 
 WHERE single_recipient = <USER ID>

Doc: https://developers.facebook.com/docs/reference/fql/unified_thread

This gives exactly what you want. The problem is:

(#298) You must be a developer of the application

Please read unified_thread still not open for public?


So, one actual workaround would be to loop on all the threads from graph.facebook.com/me/inbox?fields=to as long as you didn't find one which:

  • has only 2 participants (because some threads are group conversations and you don't want them),
  • and contains the participant who is the person represented by a user ID/username.

This has to be done manually, using your favorite language.



来源:https://stackoverflow.com/questions/19129017/is-there-a-way-to-get-the-id-of-a-message-thread-in-facebook

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