How can I launch facebook messenger with to enable

2019-08-23 22:42发布

问题:

Users log into my app through the facebook sdk. If one user clicks on another user I'd like to enable them to chat via facebook messenger. I can launch messenger from my app, but is there a way to launch into the chat screen with a specific user.

回答1:

You can open a conversation in Messenger with deep links:

  • http://m.me/{user_name} <- this is official link for Messenger. You'll need to ask user for his Messenger's username.
  • fb-messenger://user/{user_id} <- this link is not documented, so it can break any time (Deep linking). user_id probably is the Facebook User Id, so it will be easier to obtain, however you'll need to ask for user_profile permission to get user id (Messenger Permissions)