Using FB.api to make a full post to a users wall

By David Pratt / Tags: , / 21 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'] = '';
params['picture'] = '';
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:
Showing a full post to the Facebook wall


Category: Tech

Tags: ,

Posted: on September 26th, 2010 at 12:43 am.

Feeds: RSS 2.0

21 Responses to “Using FB.api to make a full post to a users wall”

fil October 25th, 2010 at 9:22 pm

Works but I’m having issues with the picture. It doesn’t show up in the post. Any ideas on how to debug? Are there size limits, specs?

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.

sukesh February 17th, 2011 at 1:30 pm

I’m new to FB development. I need your help in making an html page which can send messages to my FB wall. I tried to use your code but FB.api line is throwing javascript error ‘FB is undefined’
Thanks in advance,

sivakumar March 3rd, 2011 at 7:52 am

Hi can u pls send the full code to post the image in wall. Thanks in Advance.

NAKRES March 11th, 2011 at 7:31 pm

is this done automaticly with out pop up? where should we put this code?


Slavi March 16th, 2011 at 3:24 am

Hey, thanks for the snippet!
Just want to add that the same code works for posting on Facebook Page’s walls

replace /me/feed with /ID_OF_YOUR_PAGE/feed

khairul April 30th, 2011 at 9:11 pm

How to get ID_OF_YOUR_PAGE

Umesh August 26th, 2011 at 8:37 am

How do i assign variable to params?
please help..

Pirri September 22nd, 2011 at 11:09 am

Other way to create a shared dialog is with the function ui. In this page there is an example.

sam October 15th, 2011 at 8:30 pm

Thanks a lot boss

srilakshmi November 8th, 2011 at 1:53 pm

thanks a lot

Erwin Zarria January 4th, 2012 at 7:42 pm

Very good… Thanks!

nicky February 18th, 2012 at 5:18 am

can you help me to create this

Prashant April 19th, 2012 at 12:20 pm

Thanks buddy .. this really helped me a lot … you need to post these type of things more and more coz .. knowledge gets grower after sharing ..

Sagor April 29th, 2012 at 12:58 am

Awesome code!!! I was looking for

Vijesh September 6th, 2012 at 6:45 am

Here no need of App id & secret code?.

Alpesh September 30th, 2012 at 10:01 pm

Thanks a ton it helpd me a lot!!!

mahender October 6th, 2012 at 6:45 pm

how to display facebook login user wall feed….please help me

Ravindra Parcha March 22nd, 2013 at 7:54 am

Awesome solution….

Arindam July 5th, 2014 at 12:31 pm

How can I make the image large in fb wall? currently it is showing thumb size. But I want large size.

Leave a reply