6

I am using fb-messenger://compose to open Facebook Messenger Composer, but I can't manage to put predefined message into the composer.

Does somebody know the parameters?

Robert Keus
  • 79
  • 1
  • 7
  • There's a few Stack Overflow threads that already address this: http://stackoverflow.com/questions/25467445/custom-uri-schemes-for-the-facebook-messenger http://stackoverflow.com/questions/20059001/custom-url-to-launch-facebook-messenger-on-ios (you may need to use the Facebook SDK) – emma ray Nov 21 '14 at 16:37
  • I'm trying the same thing.have you manage to post a predefined message? – Hassy31 Feb 10 '15 at 10:47
  • Nope. We couldn't solve it. FB changed the URL Schemes :( – Robert Keus Mar 07 '15 at 12:12
  • @RobertKeus where can I find new url schemes ? – alicanbatur Mar 10 '15 at 11:55
  • How have u done that? i m struggling – user3575114 Oct 27 '15 at 15:14
  • The new schemes use Pasteboards. I answered a similar question here. http://stackoverflow.com/questions/36689056/compose-a-message-with-predefined-link-attached-from-ios-app-into-facebook-messe/36978527#36978527 – Michael Bailey May 02 '16 at 17:10

1 Answers1

9

You should send content via messenger using FBSDKShareKit.

Import FBSDKShareKit

#import <FBSDKShareKit.h>

Create content and share

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://www.url.com"];
content.contentTitle = @"My link!";
content.contentDescription = @"Check out my link!";

[FBSDKMessageDialog showWithContent:content delegate:self];

You also need to conform your controller to the FBSDKSharingDelegate

#pragma mark - FBSDKSharingDelegate

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results {

}

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error {

}

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer {

}

Available contents are:

  • FBSDKShareLinkContent
  • FBSDKSharePhotoContent
  • FBSDKShareVideoContent
Aleš Oskar Kocur
  • 1,381
  • 1
  • 13
  • 29
  • Thanks dude i have being fighting with the Messenger SDK for a few days. Didn't think to user the message dialog! sweet – YYfim Jul 21 '15 at 16:16