Share url in facebook messenger from web - facebook

I would like to share an url from a website (using mobile device) to facebook messenger app.
I tried to use:
FB.ui({
method: 'send',
link: 'http://www.nytimes.com/interactive/2015/04/15/travel/europe-favorite-streets.html',
});
But that does nothing on the mobile device. I also tried:
fb://messaging/compose/new
That did open the message dialog but I can't find an URI for sharing an url.
I wonder if this is even possible?

This is what you are looking for:
Link:
Send In Messenger
JavaScript:
window.open('fb-messenger://share?link=' + encodeURIComponent(link) + '&app_id=' + encodeURIComponent(app_id));
Please note: This will only work on mobile devices. For more information see here:
https://developers.facebook.com/docs/sharing/messenger/web

You can use the Send Dialog, which is not supported on mobile: https://developers.facebook.com/docs/sharing/reference/send-dialog#examples
Alternative for mobile: https://developers.facebook.com/docs/sharing/messenger

FWIW the following link, clicked on a desktop computer, will allow your user to share the link via Facebook Messenger. You have to replace app-id with the app-id of an arbitrary app of yours, created at developer.faceboook.com:
http://www.facebook.com/dialog/send?app_id=[app-id]&link=https://stackoverflow.com&redirect_uri=https://stackoverflow.com

<a href="fb-messenger://share/?link=http://url-you-want-to-share.com&app_id=your-app-id-here">
...
</a>
Does not seem to work on desktop, but I could be wrong.
Source: https://developers.facebook.com/docs/sharing/messenger

Related

How to open the native Facebook app from a react app link?

In my react web app I have a link to share a website url on Facebook:
<Link href={`https://www.facebook.com/sharer/sharer.php?u=${this.props.shareUrl}`}>
Share on Facebook
I could also use a plain html link like so
<a href={`https://www.facebook.com/sharer/sharer.php?u=${this.props.shareUrl}`}>Share on Facebook</a>
When this is clicked Safari is launched and the Facebook web page is displayed.
What would I need to do to get the native Facebook ios or android app to launch (instead of a browser) if it is installed? Could I carry on using this link or would I need to use a share button or install the Fb SDK?
Try this one to open a Facebook app from URL. It works for me.
Linking.openURL("fb://facewebmodal/f?href=https://www.facebook.com/FixadorPT/");

Sending URL using Facebook messenger from my Mobile Website

I am looking to send some link over Facebook Messenger app from my mobile website on Chrome Browser on my mobile. I am using the facebook messenger's custom URI Scheme fb-messenger://share. I saw this option on the the following link: Custom URI Schemes for the Facebook Messenger I used the full url as: fb-messenger://share?ShareType=ShareType.regular&share_story_url= I tried multiple options for share, as mentiond in the link above, but nothing works. It tries to open the app and closes.
You can do it by adding the following link to your page:
I don't know what else you can pass except for the link, maybe a user ID with to (probably the same params as described in the dialog method
i'm facing same issue and this is not working in ios devices.
In android devices its working fine.
I have used this one:
fb-messenger://share?link=" + smsString; (smsString is var)

Facebook share not working in mobile browser

I am using below API for Facebook share, It's working in web browser but not in mobile browser.
https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.facebook.com%2Fphoto.php%3Ffbid%3D503650586358491%26set%3Da.447778305279053.102678.420576761332541%26type%3D1&t=Breaking%3A+BUCKWILD%27s+Shain+has+died.+Our+hearts+go+out+to+his+family.+More+info+here%3A+http%3A%2F%2Fon.mtv.com%2F128hbz2
I'm using android phone.
Error message : "Your link could not be found."
Any suggestion ?
Thanks
You need url for mobile to start http://m.facebook.com/sharer.php?u=
Also the rest url wont work like that, you need url site whit the Facebook Open Graph META Tags.
From what I could see, the solution offered by vj_andrei doesn't work - the m.facebook.com/sharer url just doesn't exist.
Facebook, however, have re-introduced the share button, and it works for mobile as well.

Facebook Invite Friends to app - Dialogs requests

I use this code for inviting facebook friends to app : http://pastebin.com/A4LkB8sF
FB.ui({ method: ‘apprequests’, message: ‘Facebook Promotion App’ });
Its working fine but if they click the Link in the FB notification bar they dont get linked directly to my page and app. Instead they are at a “step between”. The app is visible in an iframe with less than 810px and no like button.
This are the link parameters:
*/?fb_source=notification&request_ids=12345621890&ref=notif&app_request_type=user_to_user&notif_t=app_request*
Where is the problem? Why is FB not linking the user to the app in page directly?
I guess the solution is somewhere in the App settings maybe… but i dont know.
Please help me, is important ?
Specify redirect_uri also in the parameters list.

Can't use facebook sharer.php custom parameters in mobile sites

I own a jQuery mobile website. There i using facebook share option with custom parameters to add title, description, image with link
Like below,
https://www.facebook.com/sharer/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https://www.google.com/images/srpr/logo3w.png&p%5Btitle%5D=My%20own%20title&p%5Bsummary%5D=My%20own%20description
But when i try the same link to mobile, it will redirect to
http://m.facebook.com/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https%3A%2F%2Fwww.google.com%2Fimages%2Fsrpr%2Flogo3w.png&p%5Btitle%5D=My+own+title&p%5Bsummary%5D=My+own+description&_rdr
which means, it will add m.facebook at the start of share url. so it wont work with custom title, desc, image & link.
Anyway to fix this? or how to force mobile web to not to go with m.facebook.com ?
You can prevent Facebook from going to the mobile site by adding a ?m2w parameter to the URL. Then, sharer.php works like usual.
e.g.
https://www.facebook.com/sharer/sharer.php?m2w&s=100.... (etc)
Looks kind of bad though, looking for a better answer.
Edit: Sharer.php has been deprecated, see Felix' answer below.
sharer.php has now been deprecated.
https://developers.facebook.com/bugs/252983554810810/
The new method is to use the share dialog:
https://developers.facebook.com/docs/sharing/reference/share-dialog
e.g.
https://www.facebook.com/dialog/share?
app_id=145634995501895
&display=popup
&href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
&redirect_uri=https://developers.facebook.com/tools/explorer
url for mobile is supported as u, and title is supported as t
http://m.facebook.com/sharer.php?u=<urlencoded url>&t=<urlencoded title>
source
Use the mobile url to fix the problem in mobile devices, Facebook will redirect to the share dialog in desktop.
http://m.facebook.com/sharer.php?u=<urlencoded url>
Here is an example:
https://careers-hangarcr.herokuapp.com/job/apply/55c277c0fb8b040300622602