How to post a link with an image on Facebook using the Graph API?

I tried two different methods.

First, specify the link in the link argument /PROFILE_ID/feed (as described in the publication section here ). The problem is that if I specify anything other than my application URL, I get an error message indicating that the URL is not valid.

The second way is to use the /PROFILE_ID/links method and specify the image URL. The problem is that when he posts, he only shows the message and URL. I have specified values ​​for the image, name and message, but none of them show.

How can I send a link with a name, message and picture?

+7
facebook facebook-graph-api
source share
2 answers

I decided to solve this problem using the /PROFILE_ID/feed method and then disabling Stream post URL security in the application’s security settings. Hope this helps someone!

+1
source share

Your first approach is correct. Does your url start with http: //? Which SDK are you using?

As described on this page, the example tells you that it should work. http://developers.facebook.com/docs/reference/api/post

 curl -F 'access_token=...' \ -F 'message=Check out this funny article' \ -F 'link=http://www.example.com/article.html' \ -F 'picture=http://www.example.com/article-thumbnail.jpg' \ -F 'name=Article Title' \ -F 'caption=Caption for the link' \ -F 'description=Longer description of the link' \ -F 'actions={"name": "View on Zombo", "link": "http://www.zombo.com"}' \ -F 'privacy={"value": "ALL_FRIENDS"}' \ -F 'targeting= {"countries":"US","regions":"6,53","locales":"6"}' \ https://graph.facebook.com/me/feed 
+5
source share

All Articles