Feed.registerTemplateBundle
From Facebook Developer Wiki
Contents |
Description
Important: With the changes to the Feed system on the home page, we suggest you register template bundles with the Feed Template Console, which uses a wizard interface for you to quickly create templates.
This method builds a bundle of Feed story templates, containing a single one line template and a single short story template, registers them on Facebook, and responds with a template bundle ID that identifies your template bundle to other Feed-related API calls. You need to register at least one bundle for each of your applications. A template bundle consists of:
- An array containing a single one line story template
- An array containing a single short story template
- Action links that add calls to action to your Feed stories
Each template consists of one or more tokens (for the story actor, friends, items, and so forth), some static text, and some FBML. Tokens must be wrapped in curly braces and asterisks, as in {*actor*}. The {*actor*} token must appear at the beginning of all one line templates and short story template titles. More details are discussed below.
The tokens used in a short story template are the union of the tokens used in its title and its body. A short story template must to be expressed as an array containing a single JSON-encoded object that includes the template_title, template_body, and other fields.
Note: You cannot use the words images, flash, mp3, or video as tokens in your templates, as they're reserved by Facebook for placement of media in short stories.
Registration Limits
You can have a maximum of 100 registered, active template bundles. If you're nearing the 100 template bundle limit, you can deactivate some unused template bundles using feed.deactivateTemplateBundleByID or the Registered Templates Console on the Developer site. Deactivated template bundles do not count against the 100 template bundle limit.
About Aggregation
Facebook no longer aggregates Feed stories.
Parameters
| Required | Name | Type | Description | |
| required | api_key | string | The application key associated with the calling application. | |
|---|---|---|---|---|
| sig | string | An MD5 hash of the current request and your secret key, as described in the How Facebook Authenticates Your Application. | ||
| v | string | This must be set to 1.0 to use this version of the API. | ||
| one_line_story_templates | array | A JSON-encoded array containing one FBML template that can be used to render one line Feed stories. | ||
| optional | format | string | The desired response format, which can be either XML or JSON. (Default value is XML.) | |
| short_story_templates | array | A JSON-encoded array containing an object, which represents a short story template. The dictionary should include two fields: template_title, which should be mapped to the FBML template used to render a short story's title, and template_body, which should map to the FBML template used to render a short story's body. The token set of a short story template is taken to be the union of the template_title and the template_body templates. | ||
| full_story_template | array | Full story templates are deprecated, but you still should pass null for this parameter. | ||
| action_links | array | A JSON-encoded array of action link records, where each record contains 'text' and 'href' fields. For more information, see Action Links. |
Example Requests
JSON-Encoded Template Array
Ruby Using RFacebook
Using the PHP Client Library
Note: For PHP, the API expects the content to be in normal array form, not JSON.
Response
This method returns a unique integer identifier that the developer can use to publish actual stories using that template bundle.
