Need a way for Facebook to render images in a wallpost when the wall post is made through the Open Graph API.
When I copy and paste this link into the Facebook UI at facebook.com, and post it that way, the wall post ends up looking like this:
But, when I try to access my wall programmatically using the Facebook Python library, using the below code, the image does not render:
graph = GraphAPI(valid_access_token)
graph.put_wall_post(message='https://s3.amazonaws.com/dotellapptest/review_photos/enlarged/811..OJUzXI76Rw6J2Zj_vZyWNw.png')
Yields this:
How can I use the Facebook API to embed an image in my wall post?
Use the link
field not the message
field via an attachment
def put_wall_post(self, message, attachment={}, profile_id="me"):
"""Writes a wall post to the given profile's wall.
We default to writing to the authenticated user's 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With