Facebook API — embed a video in a wall post that also has another link

Tag: facebook , video , hyperlink , facebook-wall Author: pillow1020 Date: 2012-12-29

I'm trying to make a wall post using the Facebook API that has a playable video thumbnail and a link field. (I am using the Facebook Python wrapper).

When you make a wall post using the API, you specify your extra content with an attachment field:

graph = GraphAPI(valid_access_token)
graph.put_wall_post(message="Hey Everyone", attachment={
  "name" : "My Cool Link",
  "description" : "It's very cool",
  "link" : "http://www.my_app_url.com"
 }

I want to add a playable video thumbnail to this. One way to do it is to put the video url in the link field of the attachment:

graph.put_wall_post(message="Hey Everyone", attachment={
  "name" : "My Cool Video",
  "description" : "It's very cool",
  "link" : "http://www.youtube.com/watch?v=some_yt_id"
 }

This renders a video thumbnail and is playable in Facebook, which is what I want, but it uses up the "link" field, so I can't use that field to link them to www.my_app_url.com. I want to be able to do both.

Anyone know how I can put a playable video thumbnail and a link to my app in a Facebook wall post through the Open Graph API?

Additional background info: There is a way to do this sort of thing with the a "picture" field in the attachment object -- this allows you to add a picture url which is separate from the main link of the attachment. The facebook docs say you can put video links in a field called "source" in the attachment, but when I tried it, the attachment didn't render the thumbnail, and it wouldn't play.

Where exactly does the docs say you can use source in the attachment?
Although technically it just says that posts "have the following fields"... it does not say for sure that you can set them all by specifying them in the attachment. So I may have misread it.
That's for reading the object, these are the fields you can create with developers.facebook.com/docs/reference/api/user/#posts

Best Answer

I ended up putting the link to my app in the message of the post, and using the 'link' field in the post attachment for the video. Not what I was hoping for but I guess it does work.