publishing on your friend’s mini feed (no session key)
the way superpokey or other applications do this, first they ask you to select some friends from your friends list, then they ask you to publish on their wall. at this stage a popup dialog opens up and asks if you really want to publish that story on your friend’s wall. if you agree, the news goes straight to your friend’s wall.
so how do they do it? you know the publishActionOfUser() actually publish feed’s on your wall, but there’s no guaranty if the news will go to your friend’s news section. so to do this, you have to use feedStoryForm. this form was introduced in facebook old profile, but comes in a new flavor when the profile section is completely redesigned by facebook. feedForms are used to publish news on user’s mini feed as well as his/her friend’s wall. but it always asks the user to authorize the publishing of news first. lets see how it actually works
step 1: register feed template
first, you have to register a feed bundle for your application. later we will use that feed bundle for publishing stories. so lets open feed console and select your application. feed console is accessible at http://developers.facebook.com/tools.php?feed
now click on next. in the next screen you have to input a one line feed template. to check if you template is valid, you can also input sample data to pass to this template as “template data” which is infact a valid json object. lets do this
note one thing that to share a feed with friends, you must put {*target*} token in the one line feed templates.
our one line feed template is: {*actor*} is publishing some news about {*subject*} on friends wall and he wants to share it with {*target*}
parameters are: {”subject”:”fishing”}
now click on next to create short story template.

short story title template: {*actor*} is sharing some news about {*subject*} with {*target*}
short story body template: {*content*}
params: {”subject”:”fishing”, “content”:”The fishing goes superb in this sunny weather”}
now click on the “Update Preview” to check the validity of our short story feed. If it’s valid, lets proceed to next step of “Full Story Template” by clicking next. both short story and full story feeds are optional. this time we will skip full story template. so on the next screen just click “skip” and proceed to final screen.
now we are on the final screen of “Creating Action Link”. lets understand what is action link. check the following picture for details of our parameters and how it will appear on your friends wall.
ok, we are done – now click on next and on the following screen click on “Register Template Bundle”, a popup dialog box will confirm you that the feed has been created and it will also show you the id of this feedbundle. note that id.
step 2: include the feedStoryForm in your application
as we have our feed bundle registered, now it’s time to go into action. lets include the feed form in our application. here’s the code
<?php
require_once 'config.php';
// Greet the currently logged-in user!
echo "<p>Hello, <fb:name uid=\"{$uid}\" useyou=\"false\" />, Its story time</p>";
?>
<form method="post"
fbtype='multiFeedStory'
action='http://sandbox.ofhas.in/fbtest/feedstory.php'>
<b>What's it all about?</b><br/>
<input size="50" type="text" name="subject" id="subject" value="" /><br/>
<b>Ok! tell your friends more about this</b><br/>
<textarea cols="50" rows="8" name="content" id="content" ></textarea><br/>
<b>Thats cool, so whom do you want to inform about it?</b>
<div style="margin:10px 0 10px 0">
<fb:multi-friend-selector condensed="true" />
</div>
<input type="submit" value="Publish News" label="Publish News" >
</form>
<script>
function shareDone()
{
new Dialog().showMessage("Info","Successfully shared your news with your friends");
}
</script>
output will be something like this
the config.php just initiated the facebook object, so nothing to mention about that. but now we have to code the handler of the feed story request that facebook will make when your users will hit the “Publish News” button.
step 3: feed story handler
this file will be invoked internally by facebook over http. in this file you have to process the parameters of yoru feed form and return a valid response to facebook as a json object so that facebook can proceed further to publish your user’s news. lets see how it works – here’s the code
<?php
$subject = $_REQUEST['subject'];
$content = $_REQUEST['content'];
$actionsubject= $subject;
?>
{"content": {"next_fbjs":"shareDone();",
"feed": {"template_id":48644843809,
"template_data": {"subject":"<?=$subject;?>",
"content":"<?=$content;?>",
"actionsubject":"<?=$actionsubject;?>"} } },
"method":"multiFeedStory" }
So we are done!
now when user’s will click on “Publish News” button after selleting friends, he will see a dialog box pops up for the authorization to publish the news – like this
user can select whether he wants to publish “short” or “one” line feed story. remember we had skipped the full story template? if we created full story template, user will get another option like “full” in this dialog box. so when this dialog box pops up, user will have to click “Publish” to publish the story.
check out the published feed on your friend’s wall

let us know your comment if you like our article. we are coming with new recipe soon.
25 Responses to “publishing on your friend’s mini feed (no session key)”
Leave a Reply

































Shaikh Sonny Aman on February 2nd, 2009
Very nicely written hasin bhai.
and the screenshots made easy understanding.
Waiting for your next article, till then let me try this
Anis uddin Ahmad on February 2nd, 2009
Great!
Hope it will be 1 stop solution center for facebook devs.
Ishtiaque on February 2nd, 2009
Just perfect. I do use friends feed on my apps but this code will definitely help me to improve them.
Thanks Hasin Bhai for starting this cool looking blog. This will be a knowledge base face for all facebook developers.
lenin on February 2nd, 2009
A jumpstart guide for FB Apps
Arafat Rahman on February 2nd, 2009
wow! how easy it is!
TRIVUz on February 2nd, 2009
great boss…. keeeeeeeeep it up
Sonny Aman on February 6th, 2009
hey.. its me on the last image!!! and two great men
anyone recognizes the other two?
Enez on March 19th, 2009
I have problem to create feed story handler in java (simpleFormController). I retrieve subject and message from request but I have problem with feed. I appreciate any help…
Ashwin Kumar H on March 20th, 2009
Hi i went through your article publishing on your friends mini feed. i understood it but i am not able to include fbtype in my form section and also this part is little unclear….I am using asp.net,c # and IFrame application…
{”content”: {”next_fbjs”:”shareDone();”,
“feed”: {”template_id”:48644843809,
“template_data”: {”subject”:”",
“content”:”",
“actionsubject”:”"} } },
“method”:”multiFeedStory” }
praj on March 30th, 2009
Its giving foolowing JSON error to me ..
“Application DumpBox sent invalid response”
Did not receive valid JSON response.
Received- null
Hui Hui on April 6th, 2009
If I want a pic inside the feed, how to do so?
Dheer on July 30th, 2009
Hi, i want to publish my friend invitation message both on news feed as well as requests(on top right corner). i want to use all these task to be done on when user click on Send button of friend invitation.
I am using fb:request-form tag.
please help.
thanks
aji jogja on August 11th, 2009
this source only for FBML?
satish on August 16th, 2009
I googled around and read through out FB Wiki but was not able to sought out publishing feed ..but your are simple THE BEST …Great Post
sakifahmeed on September 5th, 2009
thnx… nice posting.. but there is a problemmm
i cant pass this line on template: {*actor*} is publishing some news about {*subject*} on friends wall and he wants to share it with {*target*}
when i am trying to click next.. there is an error msg :
An error occurred while creating a feed story from the template and template data you provided. The specific error is listed below:
Supplied template data does not cover the following tokens [subject] needed for template ‘{*actor*} dedicate a song {*subject*} to {*target*} using Bangla Radio’
can you help me out please???
monjurulhoque on September 14th, 2009
thanks for share with us…
asafravid on October 20th, 2009
Very nice
How can I do it with PyFacebook and Python web framework?
thanks in advance
Thabelo on November 4th, 2009
Hi,
where do I get Config.php, please help
Jonathan on April 5th, 2010
Hi:
I went to the URL you mention in your article, and “Feed Template Console” is not in the tabs list. Do you know why it is not there?
rpkarmani on April 12th, 2010
ramchand
rampeyaro on April 14th, 2010
hello hi
ramchand on April 14th, 2010
ary u hav my profil pitchr
m.s. on April 29th, 2010
Hi!howdy? this is not work,for the time being… I’m noob applicatition-er (at this time)
and i had needed it really but not workkkkkkkkkk
please give to we new application publisher thanks is advance
nirbhabbarat on May 15th, 2010
http://developers.facebook.com/tools.php?feed
no longer exists
KLlkjlkk`` on May 19th, 2010
This is just time waisting code`