FeedStory form
From Facebook Developers Wiki
[edit] Description
The Feed story form is special FBML element that allows your application to publish approved Feed stories directly to a user's Mini-Feed. (You can publish directly to a user's friends' Mini-Feeds with MultiFeedStory_form).
Note: This may or may not work. There is a thread on the forums that might be of help.
To use the Feed form, create a standard HTML <form> with this special fbtype="feedStory" attribute and a standard form input submit button. We intercept the submit click.
You need to provide an action callback. On form submission, we ping your callback and wait for a response from you containing the Feed story and the follow-up URL to where the user gets redirected after publishing or canceling the form. For example, the story is specified by $feed and the follow-up URL is specified by next in the JSON example below. Or you could pass next_fbjs instead and execute JavaScript after publishing or canceling.
More information about Feed forms is available at Feed forms (for the current profile, or here for the new profile design).
[edit] Attributes
| Required | Name | Type | Description | |
| required | fbtype | string | Must be "feedStory." | |
|---|---|---|---|---|
| action | string | The callback to a feedStory feed handler. | ||
| optional | fbnext (currently does not work) | string | The URL to go to after the user publishes the story or cancels. | |
| next_fbjs (currently does not work) | string | The JavaScript to execute after the user publishes the story or cancels. |
[edit] Examples
Mood Picker
| <form fbtype="feedStory" action="http://my.app/feed_handler.php"> <select size=3 name="mood"> <option value="happy" selected="true"> happy </option> <option value="sad"> sad </option> <option value="angry"> angry </option> </select> <input type="submit" label="Mood Pick" /> </form> |
Mood Pick Handler (JSON PHP)
| <?php $feed = array('title_template' => "{actor} is feeling {mood} today", 'title_data' => array("mood"=>$_POST['mood'])); $publish = array('method'=> 'publish', 'content' => array( 'feed' => $feed, 'next' => 'http://apps.facebook.com/moodpicker/next_page.php')); echo json_encode($publish); |
Mood Pick Handler (Client PHP)
| <?php $feed = create_templatizedFeedStory("{actor} is feeling {mood} today", array("mood"=>$_POST['mood'])); $publish = encode_feedStory($feed, 'http://apps.facebook.com/moodpicker/next_page.php'); echo $publish; |
Mood Pick Handler (Ruby on Rails)
| url = "http://apps.facebook.com/yourapp/nextpage" data = { :title_template => '{actor} is feeling {mood} today', :title_data => { :mood => params[:mood] }} feedStory = { :method => 'feedStory', :content => { :feed => data, :next => url }} render :text => feedStory.to_json |
