Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share a link on Facebook Messenger from other apps?

From Facebook Developer Documentation, I see that I can share image, animated image, even audio clips from other app to Facebook Messenger. But I can see no way to share a link. Neither does when I try to look what kind of share does the FBSDKMessengerShare offer.

enter image description here

How can I share a link using Facebook Messenger?

like image 656
Chen Li Yong Avatar asked Jun 02 '16 08:06

Chen Li Yong


People also ask

How do I share an app link on Messenger?

Click the 3 dots icon on the right side of the MyLink card, then click the Share button. 2. When you select the app you want to share, you can share the My Link directly.

How do you copy a link on Messenger?

Access the page and click on the three dots at the bottom right of the screen for the Page Settings. How to copy your messaging link in the Facebook Pages app. When you click the Share Link to Message Page, it will give you the option to share it or copy it.

How do I make links open on Facebook Messenger app?

Messenger appInside Messenger, tap on your profile picture in the top left. Scroll down to Photos & Media and enter that sub-menu. The toggle for "Open Links in Default Browser" should be set to on. And there you go — Android users get the quick and easy solution to this issue.

How do I share a link in a Facebook message?

Manually enter -- or copy and paste -- the link into the "Message" field of a new message or the blank field at the bottom of an existing conversation. Hit the "Enter" key. Facebook will search for a short description and thumbnail image to attach to the link.


1 Answers

Seems that it can't be done with FBSDKMessengerShare, but with FBSDKShareKit it's possible. (I'm using Xcode 8.3, Swift 3.1, Cocoapods with FacebookShare 0.2.0)

More info available at https://developers.facebook.com/docs/sharing/ios

There are two methods:

  1. Using FBSDKMessageDialog: "The Message Dialog switches to the native Messenger for iOS app, then returns control to your app after a post is published."

    @IBAction func messengerButtonAction(_ sender: UIButton) {
    
        let linkContent = FBSDKShareLinkContent()
        linkContent.contentURL = URL(string: "https://itunes.apple.com/in/app/someValidAppURL...")
    
        let dialog = FBSDKMessageDialog()
        dialog.shareContent = linkContent
        dialog.shouldFailOnDataError = true
    
        if dialog.canShow() {
            dialog.show()
        }
    }
    
  2. Using FBSDKSendButton: "The Send button lets people privately send photos, videos and links to their friends and contacts using the Facebook Messenger. The Send button will call a Message dialog."

    This creates a share button that is displayed in a specified view. The button will be automatically disabled if the Messenger app is not installed on the device.

    override func viewDidLoad() {
    
        let linkContent = FBSDKShareLinkContent()
        linkContent.contentURL = URL(string: "https://itunes.apple.com/in/app/someValidAppURL...")
    
        let button = FBSDKSendButton()        
        button.shareContent = linkContent      
        if button.isEnabled { 
           self.view.addSubview(button) 
        }
    }
    
like image 68
David Steppenbeck Avatar answered Jan 05 '23 00:01

David Steppenbeck