The Official Blog of Cogmap, the Org Chart Wiki



A New Architecture For Facebook Feed Templates

facebook-developers-tools_1241192609257I know that usually I focus this whiney blog on maligning things other people say, but I want to actually be constructive for a change.  Let’s start with maligning things: Facebook and their newsfeed interface for application developers.

They offer two ways to create newsfeeds: A template wizard or an API.  Both are only somewhat useful because templates cannot be edited.  They can only be deleted.

Facebook strongly pushes developers to use the wizard because the wizard allows them to validate templates more effectively.  Unfortunately, using the wizard is fine for template creation, but if you want to recreate a template with a small change, it requires navigating the entire wizard process again and is cumbersome – using the wizard requires creating dummy data for every field and JSON formatting it.

The API works better, but if you need to rewrite a newsfeed template, you must delete that template, create a new template using API calls, and then put that API template reference in all of the points in your code that invoke that template.

Interestingly, I would like to propose a third solution: A generalized solution that could easily be layered on top of the existing template architecture, leverage loop holes in the current architecture model, and allow easy edits to template models.

The specific loop-hole that this would exploit is that Facebook allows applications currently to invoke other applications templates.  This type-checking is probably a good idea because it allows test versions of applications and production versions of applications to share templates without requiring recreation of templates, managing template IDs between applications, and associated testing risks.

My proposal is to create a set of generalized feed templates.  For example, one template for short stories might be:


Obviously you would need the reverse as well:


You would need versions of these templates without associated short stories and full stories, and all the various n-cases.  With and without action links.  Pretty straightforward.  Publish those template IDs and all of the sudden there is a flexible, editable architecture for crafting newsfeed stories on Facebook.

I am currently using a reference implementation of this architecture and it is working dandy.  Unfortunately, I hard-coded the action links and am far too lazy to redo it.  If I get around to it, I will do that and republish this.

Am I missing anything?

Comments are closed.