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.
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.