Home

Keebler/Blog

« WhyYouShould Facebook Application
Peter Mansbridge watches hockey »

Facebook Application Basics

As you may have noticed, I released my first Facebook Application into the wild yesterday. Since then, a bunch of people have asked me how the Facebook platform works and what it can do. Unless I’m missing them, the Facebook developer area is lacking some of the fundamentals of building an application, so I thought I’d give a brief overview here.

Basically, there are three main areas inside Facebook that your application can play with:

  1. Facebook Canvas pages which let you embed your content on a page inside Facebook accessible from the left-navigation
  2. A Profile Box which sits on your profile page and is visible by all your friends
  3. Your news feed which appears on your profile page, and is visible by your friends on their home page

You can build a Facebook Application using just Canvas pages without ever touching the API. All you need are basic HTML skills and a server. Using the API requires some programming knowledge and the handling (and storing) of a session key on your side.

Before we get into each of these areas, let’s look at how to display content in them. Facebook has produced their own markup language called FBML. As you can see in their docs, it’s basically just HTML but without the HTML, HEAD, or BODY tags, no javascript, and a bunch of tags that have special functions in Facebook. For example, <fb:share-button class=”url” href=”http://www.keebler.net”/> displays a share button that will share my blog’s URL. Some areas only allow a subset of FBML (i.e. the news feed), but in general, anything you can do in HTML, you can probably do in FBML. It even has some “Ajax” functions that allow you to load in pieces of FBML dynamically.

Now let’s look at each of the main areas:

Facebook Canvas Pages

Using canvas pages, you can embed pretty-much any functionality you want into Facebook. When you set-up an application, Facebook will ask you for your canvas page URL. The name is a little misleading because it’s actually asking you for a directory on your server where you will serve up pages for Facebook. Just give it something like http://www.yoursite.com/facebook/ and put a default page in that directory (e.g. index.html). When you go to your canvas page within Facebook via something like http://apps.facebook.com/YOUR_APPLICATION (which is accessible from the left-navigation) Facebook will request the page from your server and serve it up within the Facebook interface i.e. with their top-navigation and left-navigation. You can run whatever type of code you want on your side to generate the page (i.e. PHP, ASP, HTML), as long as it serves up as FBML.

Now here’s the really cool part: you can use relative links from your root canvas page (e.g. http://apps.facebook.com/YOUR_APPLICATION which inside Facebook is http://www.yoursite.com/facebook/) and Facebook will display those too. For example, if you have an about page on your web-server at http://www.yoursite.com/facebook/about.html, you can put an anchor <a href=”about.html”>About</a> in any FBML and Facebook will serve it up at http://apps.facebook.com/YOUR_APPLICATION/about.html. The same goes for images, forms…anything!

Using these techniques, you can build out very complex applications directly within the Facebook interface but within the context of a Facebook account with all it’s social data (like friends)!

Profile Box

The profile box is a great way to show something unique to the user whose page it’s sitting on, and advertise your application to their friends (hopefully they’ll see the “Add” button at the top-left of the box and add it to their own Facebook account). If you want to just display something basic across all your users, you can set the “Default FBML” field in your application settings. To put personalized content into the profile box, you have to use the full Facebook API using a client library. You will use the facebook.profile.setFBML function’s “markup” parameter to pass in the FBML you want to display inside the box.

News Feed

The news feed works very much like the Profile Box but you are only allowed to use a subset of the FBML. Using the Facebook API, you call the facebook.feed.publishActionOfUser function setting the “title” and “body” parameters. A news feed item will be added to the user’s profile page, and also be visible on their friends’ home pages subject to some constraints. You can only add about 5 news feed items per user per day, after which they will no longer appear until the next day. You probably want your title to look something like this: <fb:userlink uid=”12345″ shownetwork=”false” ifcantsee=”Your friend” /> just did something in <a href=”http://www.yoursite.com/”>your application</a>!


I’m really just scratching the surface of what you can build into the Facebook platform. You are only limited by the functionality you can build on your side since Facebook is only displaying what you pass it. Translation: we’re going to see some cool stuff! I’m sure the applications we’ve seen so far are nothing compared to what people will build in the months to come. I, for one, welcome our new Facebook overlords :)

Related Posts

  • The new Facebook iPhone app ca…
  • The best Facebook vanity URL: …

This entry was posted on Saturday, June 2nd, 2007 at 7:56 pm and is filed under Web Development. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

59 Responses to “Facebook Application Basics”

  1. surfer says:
    June 6, 2007 at 12:15 pm

    hey can we put a statcounter or other tracking code in our facebook so that we know when someone visited our profile?

  2. Jonathan says:
    June 8, 2007 at 2:56 pm

    I’m not sure that’s possible as of now. Most tracking code works by loading in an (invisible) graphic. Any images you include in the profile box are cached by facebook so you won’t be able to track properly. I’m sure someone will figure it out though :)

  3. kevin says:
    July 11, 2007 at 7:08 pm

    when you say to add the canvas url you say to put http://www.yoursite.com/whatever….but the options already have the http://apps.facebook.com part in there, and just want you to add to that. What should I do?

  4. Chris Liggins says:
    August 2, 2007 at 9:49 am

    I’m trying to post images in the profile page, but they are not displaying … any ideas?

  5. Jonathan says:
    August 2, 2007 at 10:32 pm

    Are you sure they are absolute URLed and available on your server?

  6. Stephen says:
    August 24, 2007 at 3:53 am

    Can I add a javascript which remotely serves up a Flash file?

    I haven’t had any success doing that yet.

  7. Stephen says:
    August 24, 2007 at 4:47 am

    Let me rephrase that question. I can get it to display the flash as an app from the left ha
    nd column, but how do I embed it into the main page automatically?

  8. Adam says:
    September 14, 2007 at 1:05 pm

    Can u make an app that lets you pin a virtual condom on the wall to say how many girls or guys u have shagged? Cos me and my mates at college are having a competition and we thought we shud ask someone like u to help? Basically can u make a pinboard picture and then have a button so u can click everytime u have shagged someone knew and it displays your total number based on the number of used jonny pictures pinned on the pinboard?

  9. Oskar says:
    September 25, 2007 at 12:30 am

    raise your hand if you think Adam is retarded

  10. charlie chaplan says:
    October 4, 2007 at 12:39 am

    hahahah *hand raised*

  11. Kashif says:
    October 4, 2007 at 11:35 pm

    *hand raised* [:P]

    i came here through google searching for a very basic question. i’m building my first facebook application, just for fun. its in php, and its my first application in php bar the helloworld i wrote before this. all i want is some text and a button on the profile box. upon pressing the button, the text will change. so i need some sort of that ajax functionality as well. i got the text in profile, but a bit confused how to put the button and how to get the text changed. could you please shed some light on this?

  12. Kim says:
    October 5, 2007 at 5:33 pm

    I was just wondering how I make italics, change font color, ect. within facebook.

    Thanks! :]

  13. Jonathan says:
    October 23, 2007 at 8:56 am

    @Kim: You can change fonts the same way you do with HTML/CSS :) You just add CSS “STYLE” attributes to your text.

  14. Leveraging Facebook by creating apps for it, make huge money! says:
    October 29, 2007 at 7:30 pm

    [...] Calm down… if you want to start creating your own Facebook application. Here is a tutorial that will teach you the basics. Don’t forget to check Facebook’s own Developer’s Area too. Lastly, here is a tutorial on developing a Facebook platform application with Ruby On Rails. Good luck with your application development! And don’t forget to donate some to AdesBlog if you become millionaire! ;) [...]

  15. JB says:
    November 5, 2007 at 4:54 pm

    How odes one make money making Facebook applications?

  16. Nevil says:
    November 8, 2007 at 2:02 am

    Firstly HAND RAISED FOR ADAM! Idiot (why don’t you message the tool that made that anoying fishtank app and ask him.

    Secondly, you go to college and you spelt ‘new’ with a k
    (“so u can click everytime u have shagged someone knew”)

    Onto something a little more mature, I have been reading through the FBML wiki and trying to understand the code to display an image from a site external to facebook, any info will help greatly.

    Cheers,
    -Nev

    P.S. the code for this form seems to be unstable (maybe just my machine)

  17. Nevil says:
    November 8, 2007 at 2:10 am

    Oh and very informative Blog mate. I am also looking for any good book on FBML, facebook applications, etc.. if there is such a thing.

    Any ideas, let me know. I have tought myself some code in bits and peices for web design using different books and sites like http://www.w3schools.com and would like to find something similar for facebook.

    Cheers again,
    -Nev

  18. Spencer Shubert says:
    November 11, 2007 at 5:06 pm

    I have an idea for a facebook application but no knowledge to allow me to actually pursue it, if anyone knows what they’re doing and may want to hear it, email me: spencershubert@hotmail.com

  19. Ivan says:
    November 19, 2007 at 8:50 pm

    I was wondering if I could create an app that would allow people to put comic sings in pictures, like those ballons that appear in comics saying things or just creating funny onversations and stuff. Does any one know if this is possible?

  20. Ivan says:
    November 19, 2007 at 8:51 pm

    my email is spacedesigner@msn.com

  21. Gustav says:
    November 22, 2007 at 10:23 am

    I have an application idea but no idea how to make the application, it is a very simple application and would not take someone who knows what they are doing very long to make. if you know what your doing and would like to hear the idea please email me at gustav1908j@hotmail.com
    thanks

  22. Matt says:
    December 4, 2007 at 6:17 am

    Hi. Also looking for a developer-partner to help me create some facebook/myspace apps.
    mattgfx (at) gmail.com

  23. calvin says:
    December 4, 2007 at 10:44 am

    looking for some help on an app similar to your flicker 2 facebook app…can you please follow up w/me at uceceo[at]gmail[dot]com

  24. Eric Hanson says:
    December 5, 2007 at 5:21 pm

    I would like to create an application that contains a search box for my library’s catalog and an image of our sybol. Is it difficult to place a search box, much like the “JSTOR application” into an application to be used on my libary facebook page?

  25. yimplex says:
    January 3, 2008 at 10:30 am

    I want to make my own application
    Where the document?

  26. Rob says:
    January 4, 2008 at 2:51 am

    Alright… this may be out of my league as far as development, but i got some time and i really want to make an application based off the HBO Series : Entourage.
    I want to make it similar to other show’s applications, such as the Addicted to Boy Meets World application. Any help would be tremendously appreciated :)

  27. Miki Olsen says:
    January 11, 2008 at 5:45 am

    Hey .. anyone want to help me out with an app. and advise regarding this (maybe its just a bad idea) … its about a party/event app.

    but if anyone is interested plz. mail me at miki@houseparty.dk or msn@houseparty.dk…

  28. Facebook » Facebook Application Basics says:
    January 29, 2008 at 12:25 pm

    [...] Online Fandom wrote an interesting post today on Facebook Application BasicsHere’s a quick excerpt [...]

  29. Facebook » Facebook Application Basics says:
    January 29, 2008 at 12:26 pm

    [...] Product Reviews Net wrote an interesting post today on Facebook Application BasicsHere’s a quick excerpt [...]

  30. Tools 4 Facebook News » Archive » Basics to develop a Facebook Application says:
    February 7, 2008 at 1:02 pm

    [...] Keebler/Blog you will find some basics to know before developping a facebook [...]

  31. Tommaso Paiar says:
    February 26, 2008 at 7:47 am

    Hi,

    if I create a new application of Facebook, will I be paid/get a share of the ads?

  32. Miriam says:
    March 1, 2008 at 2:18 am

    hey, I appreciate your help.

    I really wanted to build my own applications for my own web site, I was wondering does one need to do a course in something , eg programming, in order to be able to achieve this?

    Please give me a list of courses i should look into , or any self help books or web sites.

    I’m a novice at building web sites, im currently learning how to use Dreamweaver CS3.

    Thanks in advance.

    Regards,

    Miriam.

  33. JP says:
    March 11, 2008 at 1:56 pm

    Hey if I’m making my application in visual studio, I know that I can host it locally and just link to the local host to get it to show up but only to me, no one else can access it. If I want to upload it to the web so that everyone can see it, what files/folders do I upload and what do I link to

  34. Jill says:
    March 16, 2008 at 2:00 pm

    I found this webite when randomly wondering how to create an application, this may sound like the most simple question but How do you get to the place where you can create an application? Is it on the Facebook website or do you have to download something?…I’m sorry if that sounded stupid but that’s all I was wondering.

  35. Chris says:
    March 21, 2008 at 4:18 pm

    Great Post man! I’m continually amazed by how difficult proprietary solutions make integration on various media. I understand Google is working on some sort of universal protocol for wigets/social media apps. Any thoughts on this?

  36. John says:
    April 3, 2008 at 1:04 pm

    Thanks for sharing some great information regarding applications.

  37. Bob says:
    April 9, 2008 at 11:33 am

    This is just what I have been looking for for ages, thanks for the information.

  38. Erica says:
    June 12, 2008 at 11:34 pm

    I wanna start an uno application… how do i do that

  39. Mary says:
    June 27, 2008 at 3:21 pm

    because many people have asked, go here and click on the “add developer” link

  40. PaulsBlogging.com says:
    June 30, 2008 at 1:01 am

    Whoa Dude….

    This isn’t making a ton of sense. I’m sure you’re explaining it fine, but I’m not working it out right or something.

    I have a sever and basic…. basic, basic HTML knowledge.

    Is there anyway you can explain this out to me from start to finish? My friend and I really want to make an app.

    I can give you my number via email if need be. I’d eally appreciate your help.
    I hope it’s not asking too much.

    Thanks, Man.

  41. Toogle says:
    July 31, 2008 at 1:59 pm

    can I drop my RSS feed into a facebook app?

  42. Amit says:
    August 4, 2008 at 12:43 pm

    This is by far the most elegant and above all most useful guide all over the internet. Thank you.

  43. Josh says:
    August 4, 2008 at 8:33 pm

    I had an idea to create an app so people could rate their landlords. If something like this exists, I’m find just adding it, but if not, could someone help me out on how to get started?

  44. Andrew says:
    August 8, 2008 at 9:33 am

    Am trying to attach my myspace page on my face book profile. How do i do that.

  45. Understanding (and utilising) Facebook from a Marketing Perspective ยป Zakazukha Zoo Online Marketing Blog says:
    August 25, 2008 at 6:39 pm

    [...] applications (although it seems people are pretty much over them, myself included), check out this post by Jonathan which gives a run-down of the basics. Anyone considering Facebook should also read [...]

  46. Cindy says:
    September 15, 2008 at 6:49 pm

    just want to know if we have to pay to add an application onto facebook??

  47. Jonathan says:
    September 15, 2008 at 7:14 pm

    There’s no fee charged by Facebook. You just need to pay for your own servers, etc. to run the thing.

  48. Cindy says:
    September 15, 2008 at 7:15 pm

    Thanks Johnathon! :)

  49. Jeff Davidson says:
    November 29, 2008 at 8:59 pm

    Jonathan (or anyeone else reading this) – can I pay you to build what is likely a relatively medium difficult level facebook app?

  50. Facebook App Developer Wanted says:
    December 4, 2008 at 1:48 pm

    Facebook App Developer Wanted please contact my if you interesting.

Newer Comments »
  • Blog Home

  • Tags

    90210 alessandra ambrosio animals asp.net audrina patridge battlestar galactica bikini bunny bush C# canada canada election ctv ctvglobemedia development Election Entertainment/Celebrity facebook Gordon Ramsay gorilla gossip girl hayden panettiere iphone last.fm liveblog liveblogging mesh08 muchmusic Music obama palin rachel bilson scribblelive shenae grimes subway telemarketers the hills the killers the office toronto ttc toronto tv us election video yeah yeah yeahs

    WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

  • Recent Posts

    • Got tickets for USA vs. Switze…
    • On my way to YYZ to fly to the…
    • RT @scribblelive: Financial Po…
    • In Olympic Skelton, Canadian M…
    • Hoping people keep putting pre…
  • Categories

    • Election
    • Entertainment/Celebrity
    • Fake News
    • Featured
    • Funny
    • Keebler/Show
    • Music
    • My Releases
    • On-the-Road
    • RedDot
    • Reviews
    • Science/Technology
    • ScribbleLive
    • Security
    • Software
    • Torrent Live Stats
    • Tweets
    • Uncategorized
    • Web Development
  • Blogroll

    • Kitten-Monkey’s Cell
    • :: kattekylling ::
    • Adam Finley
    • blog-j
    • fuzzz.gaulin.ca
    • Idiot Banter
    • mad.greyarea.com
    • ob.blog
    • PollyPrissyPants
    • RedDot CMS Users Google Group
    • ScribbleLive Official Blog
  • My Sites

    • Flickr2Facebook
    • RedDot CMS
    • ScribbleLive
    • Where are my f(acebook)ing friends?
    • WhyYouShould