Keith Bloom’s Blog

Creating a Facebook application

June 4, 2008 · Leave a Comment

Introduction

Facebook has been a hot topic of late internally and globally, every day more people are joining. What I don’t know is how are applications developed that run in Facebook and what opportunities does is offer?

Background

Facebook is a social network currently running at 50 million users. As a member you have a profile page where you can upload photos, your thoughts and add applications from third parties. When you have your profile created you can allow you friends to view it and start building your social network. Once in place members of this network will receive news alerts about changes you make. It is these connections between people that Facebook say is the next leap in communications, they call it the Social Graph. As the number of users on Facebook is very large and interconnected there is a massive potential for reaching specific groups of people as they will pass the information around. The video from the developers launch has more details.

Creating an application

Think of Facebook as an operating system, you develop and host your application on your own web server and then install it on Facebook by adding it as an application. Facebook then provide two API keys for the application to use. A callback URL is has to be set and this is the hook that Facebook uses to call the application. To illustrate this will create an application called list-my-friends. The callback URL for this is:

  • http://webapps.keithtest.com/list-my-friends/

The list-my-friends application is now live and Facebook will send the any visits to http://apps.facebook.com/list-my-friends/ to the above address. Of course this will generate an error as there isn’t anything there. Facebook provide a set of tools for developers and amongst them are:

  • a markup language call FBML
  • a query language called FQL
  • and a REST based API

For the list-my-friends application we could write our own code to use these tools but there is already a .Net framework available called Facebook.Net which provides a set of ASP.Net controls to that encapsulate the Facebook API. A sample of the code required for list-my-friends:

<fb:FacebookApplication runat="server" id="fbApp" Mode="Fbml" ApplicationKey="[your_app_key]" Secret="[your_app_secret]" /> <fb:editor action="Default.aspx"> <fb:multi-friend-input />

The file is saved as index.aspx in the webapps.studygroup.com\list-my-friends folder. Now when anyone runs the application they will see a list of all their friends. This very simple example is doing two things:

  1. Creating a connection to the Facebook API using the applications key and secret which were provided when list-my-friends was created
  2. Creates an instance of the Facebook control for listing friends.

This application is run as part of the Facebook page. It can also be run within an Iframe on Facebook which allows for greater control over the page and a simpler development process. It does add a greater overhead in style the page to look like Facebook.

Summary

Facebook provides a solid framework for extending their site with custom components and this is arguably something new. They have fueled a vast amount of activity from 3rd party developers but so far the applications are simple widgets that extend current functions like posting on peoples wall or adding video to your page.  I am wondering:

  • What application can I create that increases drives sales and is a compelling reason for a member of Facebook to add it to their profile?
  • What overhead will there be in developing an application hosted on Facebook? There will be a need for managing API keys and application registrations
  • What happens if Facebook looses popularity? It is a closed system and anything developed for it would have to be re-factored for the next hot potato

Your comments and feedback would be great.

Categories: ASP.NET · Facebook

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment