02 January 2011

How to provide Post results on a Facebook wall facility in a Facebook Application?

Today development of Facebook application has become a trend; people have shown a great interest in developing many Facebook applications in order to publicize their products in recent years.

I have also developed a small Facebook application.

While developing that application, I found a great difficulty in implementing post results on Facebook wall feature .After long time search I was successful in implementing this feature, so through this post I will give you a brief overview of how to implement it.

In order to implement this feature, all you have to just use one inbuilt function of Facebook API i.e. Facebook.streamPublish()

In below mentioned link, you can find all the details of this function

Here is a small example, which you can refer for your application.

First of all I have created a button for this using following code.

<input type="button" onclick="Facebook.streamPublish('', attachment,null, null, 'Update your Status');" value="Post results on Wall"/>

After clicking this button you will get a small light box as shown below,

Now on clicking Publish button the results will get published on your Facebook wall.

Along with this you also have to write a small script which is necessary for this function to work
var attachment = {
"name":'The Engineering Purity Test',
"href":'Url of your Application',
"description": message,
"media": [
"type": "image",
"src": "image url",
"href": "Url of your app"

This is what all you have to do! If any point is not clear feel free to ask