Script to open facebook messenger application

3

I'm creating a app , and I wanted to insert a button to open a conversation on a particular facebook page, but by the messenger application and not by the browser, / p>     

asked by anonymous 26.06.2015 / 05:12

2 answers

1

Open a conversation on a page you mean a post, right?

You can try this:

NSURL *url = [NSURL URLWithString:@"fb://post/<id_do_post>"];
[[UIApplication sharedApplication] openURL:url];

Now if you are talking about opening the fanpage or profile of someone just change the beginning of URL , example:

NSURL *url = [NSURL URLWithString:@"fb://profile/<id_da_page_ou_perfil>"];
[[UIApplication sharedApplication] openURL:url];

More options you can see here:

link

    
26.06.2015 / 05:28
1

To open a particular thread in Facebook Messenger simply use the URL Scheme fb-messenger://user/{user-id} . The parameter user-id is a long integer as can be seen in link .

More information this OS response.

Please note that from iOS 9 the Messenger Scheme URL ( fb-messenger ) needs to be placed on your whitelist.

I also recommend that you check with canOpenURL: first and make a fallback if the user does not have the messenger installed.

    
09.07.2015 / 04:31