MultiFeedStory form

From Facebook Developers Wiki

Jump to: navigation, search

[edit] Description

The multi-Feed story form is special FBML element that allows your application to publish Feed stories directly to a user's friends' Mini-Feeds. (You can publish directly to a user's Mini-Feed with feedStory_form).

To use the Feed form, create a standard HTML <form> with this special fbtype="multiFeedStory" attribute, and include a condensed fb:multi-friend-selector, fb:multi-friend-input, or fb:friend-selector.

For all of these forms, you can use a standard form input submit button, and we intercept the 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.

More information about Feed forms is available at Feed forms (for the current profile, or here for the new profile design).


[edit] Attributes

RequiredNameTypeDescription
required fbtype string Must be "multiFeedStory."
action string The callback to a multiFeedStory feed handler.
optional fbnext string The URL to go to in case of an error.


[edit] Examples

Utensil Poke <form fbtype="multiFeedStory" action="http://my.app/feed_handler.php"> <select size=3 name="utensil"> <option value="spoon" selected="true"> spoon </option> <option value="fork"> fork </option> <option value="knife"> knife </option> </select> <fb:multi-friend-input> </fb:multi-friend-input> <input type="submit" label="Utensil Poke" /> </form>


Poke Handler (JSON PHP) <?php $feed = array('title_template' => "{actor} poked {target} with {utensil}", 'title_data' => array("utensil"=>$_POST['utensil'])); $data = array('method'=> 'multiFeedStory', 'content' => array( 'feed' = > $feed, 'next' => 'http://apps.facebook.com/utensilpoke/next_page.php')); echo json_encode($data);


Poke Handler (PHP client) <?php $feed = create_templatizedFeedStory("{actor} poked {target} with {utensil}", array("utensil"=>$_POST['utensil'])); $data = encode_multiFeedStory($feed,'http://apps.facebook.com/utensilpoke/next_page.php')); echo json_encode($data);