The first and probably most important thing you have to know about working with Facebook is that it is not like other APIs you have worked with in the past. Consider the Yahoo! API (you can find nice ColdFusion wrappers for this API at http://cfyahoo.riaforge.org). The Yahoo! API is a set of URLs that server-side code can use to request a specific set of data and then parse the response. So to get weather for Lafayette, LA, I simply need to have ColdFusion request this URL: http://weather.yahooapis.com/forecastrss?p=70508. This returns an RSS response that is simple to parse with ColdFusion. But notice the order of execution here. The user goes to my site and requests some ColdFusion file. My ColdFusion code does an HTTP call behind the scenes to Yahoo and parses the response. The nicely parsed response is then returned to the user.
Facebook flips this scenario around. Since you are extending the Facebook site, not your own, you end up building code that acts much like Yahoo's service. A user will visit the Facebook site and run your application. Facebook acts like a broker. On the user's behalf it will send an HTTP request to your server. Your server will examine the call and respond accordingly. Facebook will then present the result back to the user.
When your code responds to Facebook, it can include both normal HTML (with some restrictions) and FBML (Facebook Markup Language). FBML includes special tags that Facebook will parse before returning to the user. FBML includes some basic widget and layout support as well as items that will automatically load in user data. Here is a simple example. (Don't worry about the exact syntax for now, I just want you to see an example of what FBML looks like.)
<fb:dashboard>
<fb:create-button href="#">Hello world!</fb:create-button>
</fb:dashboard>
This creates a simple button within my Facebook page (see Figure 1).

Figure 1: A simple Hello World button in Facebook
Note that the button is correctly styled to match well with the rest of the site. Here is another example, and again, don't worry so much about the code, but notice the result:
<cfoutput> <p> Hello <fb:name uid="#request.userID#" useyou="false"/>!</p> Here are your friends: <fb:friend-selector uid="#request.userID#" name="uid" idname="friend_sel" /> </cfoutput>
In this example I'm using a fb:name tag, which displays the name of the user. The second tag, fb:friend-selector, will create a cool, Ajax-based
friend selector. As I type, this selector shows me a list of names that match
my search (see Figure 2).

Figure 2: A sample Facebook page using the name and friend-selector tags
Another piece to the platform is the REST interface. FBML lets you include UI items and widgets easily, and it helps you request other information as well. As an example, the REST interface allows your application to send notifications to the user. It allows the application to work with events. It even allows the application to work with your friends. See the section "Where to go from here" for information on a ColdFusion Component that makes this REST interface very simple to use.
Yet another feature of the platform is FQL, or Facebook Query Language. As you can probably guess, this is an SQL-type interface to Facebook. Here is a simple example:
select name, pic from user where uid IN (SELECT uid2 FROM friend WHERE uid1 = X) and sex = 'Female'
This code will select the name and picture from all the friends of×(this would normally be a Facebook user ID) where the sex is female. You can use FQL via the REST API to perform even more complex interactions with Facebook. There is even more to the platform, but for now, let's get started with a simple application using ColdFusion.