Facebook share link with custom text

alonn24 picture alonn24 · Dec 24, 2014 · Viewed 8.2k times · Source

How can I share a simple text on facebook, without any link? just a simple text.

I tried the http://www.facebook.com/sharer.php?s=100 API, but that works only when sharing a link. I tried the https://www.facebook.com/dialog/feed? but I just could not manage it.

http://plnkr.co/edit/i7VmkZsb1rNqeEvmYyo6?p=preview

<a href='http://www.facebook.com/sharer.php?s=100
&p[title]=Title that I want to share' target='_blank' >
facebook sharer api
</a>
<br />
<a href='https://www.facebook.com/dialog/feed?
app_id=145634995501895&caption=Title that I want to share' target='_blank' >
facebook feed api
</a>

EDIT

It appears that I can't open a share box with my own custom text.

In the plunker above,
facebook share box fill 'http://run.plnkr.co/pYfbydYpZQfB5I3r/' in the share text.
How do I open the share box without any values?

Answer

luschn picture luschn · Jan 3, 2015

First of all, sharer.php only takes the URL as parameter, it reads the Open Graph tags directly from the URL and you can't dynamically set anything. It is meant to share an URL, not just a message - and the message must be written by the user.

That being said, prefilling the message parameter is not allowed, not in any way:

Don't prefill captions, comments, messages, or the user message parameter of posts with content a person didn’t create, even if the person can edit or remove the content before sharing.

Source: https://developers.facebook.com/policy

There is only one way to prefill the message, and that is by authorizing a User with the publish_actions permission and using /me/feed to post a message. But publish_actions has to get approved by Facebook before you go public with an App - and even for that you have to present a possibility for the User to fill the message on his own. It always must be 100% User generated, without any prefilling. So you would never get through the review process, i am afraid.

More information about sharing on Facebook: https://developers.facebook.com/docs/sharing