Rohit Goyal
Rohit Goyal

Reputation: 1539

How to use Facebook messenger api in react native

I am using react-native-fbsdk to use Facebook APIs in my react native project. I am able to implement login/share/logout functionalities using this but till now haven't found any way to use Facebook messenger APIs.

Is there any way I can integrate FB messenger API in a react native project using this library?

Thanks.

Upvotes: 4

Views: 4339

Answers (1)

gowithefloww
gowithefloww

Reputation: 2251

Here is how to do it with React Native's Linking:

Linking.openURL(`fb-messenger://share?link=${sharingUrl}`);

where sharingUrl is the link you want to attach.

Result

This will open Messenger app with the attached link and the user will be able to add a message to it and send it to his friends. (Caution: nothing will happen if the user does not have Messenger installed.)

Prefilling a message seems impossible however.

See the doc

Upvotes: 3

Related Questions