Facebook wallpost image will not be displayed when publishing through the Open Graph API

You need Facebook to display the images in the wall post when the wall post is executed through the Open Graph API.

When I copy and paste this link into the Facebook user interface on facebook.com and send it like this, the verbatim message looks like this:

Successful rendered image in FB wall post

But when I try to access my wall programmatically using the Python Python library using the code below, the image does not display:

graph = GraphAPI(valid_access_token) graph.put_wall_post(message='https://s3.amazonaws.com/dotellapptest/review_photos/enlarged/811..OJUzXI76Rw6J2Zj_vZyWNw.png') 

Yields:

unsuccessful Facebook wall post with image

How can I use the Facebook API to embed images in my post?

+7
source share
1 answer

Use the link field not in the message field using an attachment

 def put_wall_post(self, message, attachment={}, profile_id="me"): """Writes a wall post to the given profile wall. We default to writing to the authenticated user wall if no profile_id is specified. attachment adds a structured attachment to the status message being posted to the Wall. It should be a dictionary of the form: {"name": "Link name" "link": "http://www.example.com/", "caption": "{*actor*} posted a new review", "description": "This is a longer description of the attachment", "picture": "http://www.example.com/thumbnail.jpg"} """ return self.put_object(profile_id, "feed", message=message, **attachment) 

https://github.com/pythonforfacebook/facebook-sdk/blob/master/facebook.py#L142

http://developers.facebook.com/docs/reference/api/user/#links

+4
source

All Articles