Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Messenger Compose Predefined Message

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?

like image 420
Robert Keus Avatar asked Nov 21 '14 15:11

Robert Keus


1 Answers

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
like image 135
Aleš Oskar Kocur Avatar answered Sep 27 '22 23:09

Aleš Oskar Kocur