Sending message from iOS application to FB messenger app
Asked Answered
L

1

0

I need to send a pre-filled message from my app to the fb messenger app. I followed the post SO Link. The custom URL just opens the fb messenger app but shows no change.

Below is the code that I have tried:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://contacts"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://share"]];

The above code just opens the fb messenger app, it does not navigate to contacts page or the compose screen.

Has anybody faced the same situation? Does anybody know the code for sending the text I want to share from the app? Examples would be appreciated.

Lynellelynett answered 11/11, 2014 at 21:21 Comment(2)
Side note: Facebook doesn't like when your app auto-populates post text.Northwesterly
Facebook does more then not like it. It is not allowed according to Facebook Platform Policy that you can read at developers.facebook.com/policy . Not that you can do it but if you could we would ban your app anyway.Vi
F
1

Go with following code its will works for you

NSURL *fbURL = [NSURL URLWithString:@"fb-messenger://user-thread/USER-ID/"];
if ([[UIApplication sharedApplication] canOpenURL: fbURL]) {
[[UIApplication sharedApplication] openURL: fbURL];
}
Fumikofumitory answered 4/6, 2015 at 8:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.