New Design Feed Forms

From Facebook Developers Wiki

Jump to: navigation, search

This is a preview of the new design version of Feed form. This has slightly different syntax and design from the old Feed forms.

Feed forms are special FBML components that allow applications to publish Feed stories on the behalf of users. There are two types of Feed forms:

  • feedStory, which you use to publish stories to the current user's Mini-Feed.
  • multiFeedStory, which you use to publish stories to friends' Mini-Feeds.

You create a Feed form using a standard HTML <form> tag marked with a special fbtype attribute. The rest of the form works exactly like a normal HTML form. Feel free to put whatever elements you need to collect information, to create the object behind the story.

<form fbtype="feedStory" action="http://my.canvas.com/feed_handler.php"> <input type="text" name="status" /> <input type="submit" value="Publish" label="Publish" /> </form>


When the user submits the form (click the button, don't hit enter for now), Facebook does some special handling of the form behind the scenes (similar to how we handle fb:request-form). We intercept the submission and pass it along with the form data to your action attribute. Instead of sending back FBML, your application should send back a JSON response with the Feed story (and its registered bundle). A basic response is a simple title and body.

{"content": {"feed": {"template_id":55555555, "template_data": {"status":"status"} } }, "method":"feedStory" }


Once the data is returned we display a preview to the user and give him the option of publishing the story.

The application also has the option of blocking the Feed story because of validation or other data issues. If we receive an error code, then we let you display an error message.

{"errorCode": 1, "errorTitle" => "Status Error", "errorMessage" => "That status was not very exciting" }