Share url in facebook messenger from web

Christophe picture Christophe · Jan 8, 2016 · Viewed 40.5k times · Source

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?

Answer

Milen Kovachev picture Milen Kovachev · Jan 4, 2018

This is what you are looking for:

Link:

<a href=”fb-messenger://share/?link= https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fsharing%2Freference%2Fsend-dialog&app_id=123456789”>Send In Messenger</a>

JavaScript:

window.open('fb-messenger://share?link=' + encodeURIComponent(link) + '&app_id=' + encodeURIComponent(app_id));

Please note that it works only on mobile. For more information see here:

https://developers.facebook.com/docs/sharing/messenger/web