O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Three Story Sizes: Working with Template Bundles

Problem

I’d like to be able to publish stories that take advantage of the one-line, short story, and full story formats introduced in the mid-2008 Profile redesign. What do I need to do?

Solution

In addition to splitting Profiles into multiple tabs, the Profile redesign also saw the advent of Feed stories appearing in one-line, short story, and full story formats. As a developer, you need to register “template bundles” with Facebook before you can publish stories in the different formats. Template bundles contain at least one of:

  • One or more one-line story templates

  • One or more short story templates

  • One or more full story templates

You can specify multiple one-line templates by including them in a JSON-formatted array. Remember that order is very important here, and you want to include your most detailed template first and your least detailed last. For example:

{*actor*} just shared a {*nap-type*} with {*target*}.
{*actor*} just shared a nap with {*target*}.
{*actor*} just napped.

Tokens are always in the form {*token_name*}, and subsequent templates should only ever include a subset of the tokens used in the template prior (in other words, your templates should get less and less detailed without introducing new content). See the Discussion for more info about tokens. Facebook will always use the most flexible (i.e., the first) template for Mini-Feed stories, and it will try to aggregate stories together for News Feeds. Keep in mind that your ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required