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.