Search code examples
facebookurlhyperlink

Facebook share link - can you customize the message body text?


I'm trying to create a link that will share a page on Facebook. So far I've got:

href="http://www.facebook.com/sharer.php
?u=http%3A%2F%2Fwww.cnn.com%2F
&t=CNN%26s+website"

However, I'd really like to add some text that will go in the 'What's on your mind?' text box (especially as the t value gets overridden by the link's title). Does anyone know if this is possible?


Solution

  • You can't do this using sharer.php, but you can do something similar using the Dialog API. http://developers.facebook.com/docs/reference/dialogs/

    http://www.facebook.com/dialog/feed?  
    app_id=123050457758183&  
    link=http://developers.facebook.com/docs/reference/dialogs/&
    picture=http://fbrell.com/f8.jpg&  
    name=Facebook%20Dialogs&  
    caption=Reference%20Documentation& 
    description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
    message=Facebook%20Dialogs%20are%20so%20easy!&
    redirect_uri=http://www.example.com/response
    

    Facebook dialog example

    The catch is you must create a dummy Facebook application just to have an app_id. Note that your Facebook application doesn't have to do ANYTHING at all. Just be sure that it is properly configured, and you should be all set.

    November 2021 update

    The feed part of the Dialog API no longer includes the message field in the message. It is not included in the feed dialog documentation. The fields picture, name, caption, and description are now deprecated.

    Therefore, for the purpose of sharing to the wall, you're better off with sharer.php, which does not require an app_id, and therefore does not need registering an app:

    http://www.facebook.com/sharer.php?u=https://example.com