Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

  • Blog Navigation
Railsconf: Giving Rails the Big F – Surviving Facebook Integration Unscarred, Greg Borenstein

The Facebook API Menagerie

Facebook API has many different parts:

Canvas Apps

FB requests from your site, they inline the resonse in the middle of the page.

  • Not available: JavaScript.
  • Available: FBJS – a sandboxed limited JS API, FBML – a templating language, the FB session.

iFrame Apps

Your response is put in an IFRAME on the page.

  • Available: FB session.
  • Not available: FBJS, FBML.

Connect App

Host your app on your own domain.
Connect back into FB to e.g. user their authentication & friends model.

  • Available: Connect Session
  • Not available: FB Session


  • No JS

Think of FB as a browser


  • REST API – api/ – awesome URL.
  • Facebook does not do GETs, they always POST to your site.
  • Connect inside an iFrame, Connect requires the XHTML doctype to work, but iFrames are not supported in XHTML.


Running your App in development

  1. Create an app
  2. Setup, point it at your IP address
  3. open ports on your local network
  4. Add /etc/host entry:

Abstract the API

  • Use Facebooker.
  • Access everything through the session
    if session[:facebook_session]
    @friends = session[:facebook_session].user.friends.collect do |f|
    User.find_by_fb_user_id f.uid

Project your code

e.g. use rack-facebook so everything is not a POST


  • Frakie: Facebooker for Sinatra
  • rack-facebook: tranlates FB POST to correct action

How can I make things better?

  • Need a test harness for session[:facebook_session]. There is something in facebooker that needs extraction.
  • Greg is starting Faceboot API Continouus Integration Suite of Tests – – some JS hooks to green/red light that your tags are actually showing up in the page.
Share This