Using FB.api to make a full post to a users wall
By David Pratt / Tags: facebook, javascript / 20 Comments / Published: 26-09-10
I just thought I’d make another quick post about the Facebook Graph API seen as there seems to be so little documentation and examples for it. The below example shows you how to make a full wall post with message, name, description, link, picture and caption to the wall of a Facebook user using JavaScript to call the Facebook FB.api.
So, assuming that you have an authenticated session, here’s what you need to do:
var params = {};
params['message'] = 'Message';
params['name'] = 'Name';
params['description'] = 'Description';
params['link'] = 'http://apps.facebook.com/summer-mourning/';
params['picture'] = 'http://summer-mourning.zoocha.com/uploads/thumb.png';
params['caption'] = 'Caption';
FB.api('/me/feed', 'post', params, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Published to stream - you might want to delete it now!');
}
});
If you do this right you should get something like this appearing:

Spamtastic.
Subscribe via RSS
Twitter
fil October 25th, 2010 at 10:06 pm
My preliminary experimentation shows that the image is ignored if the ‘source’ attribute is provided. Without source the picture loads fine.