Building Facebook Applications with Ruby on Rails Zachary Taylor - - PowerPoint PPT Presentation

building facebook applications with ruby on rails
SMART_READER_LITE
LIVE PREVIEW

Building Facebook Applications with Ruby on Rails Zachary Taylor - - PowerPoint PPT Presentation

Building Facebook Applications with Ruby on Rails Zachary Taylor Silicon Valley Ruby on Rails December 13, 2007 Why Facebook? 50 million+ users, more than 20 million active Potential for massive viral distribution Build just for


slide-1
SLIDE 1

Building Facebook Applications with Ruby

  • n Rails

Zachary Taylor Silicon Valley Ruby on Rails December 13, 2007

slide-2
SLIDE 2

Why Facebook?

  • 50 million+ users, more than 20 million active
  • Potential for massive viral distribution
  • Build just for Facebook, or compliment your

existing app

slide-3
SLIDE 3

Anatomy of an App

  • Left Nav
  • Canvas Pages
  • Profile
  • Profile Box
  • Profile Action Links
  • News Feed
  • Alerts
  • Message Attachments
  • Requests
slide-4
SLIDE 4

Other pieces

  • Product Directory
  • About
  • Privacy Settings
slide-5
SLIDE 5

Get started

  • Add the Developer Facebook app
  • Set up a new application
slide-6
SLIDE 6
  • Application name
  • Callback URL
  • Path to the Facebook app on

your server

  • Canvas page URL
  • Path on Facebook where your

app will live

  • IFrame or FBML?
  • Can your application be added
  • n Facebook?
  • Post-Add URL

To set up your app:

slide-7
SLIDE 7

FBML vs. Iframe

  • FBML
  • Many convenient Facebook-specific tags
  • Easier to make your app look ‘native’
  • Facebook helps with caching
  • No Javascript, ‘Mock’ AJAX
  • Can embed Iframe
slide-8
SLIDE 8

FBML vs. Iframe

  • Iframe
  • Requests to the canvas page are redirected to your

server, and displayed in an Iframe

  • Full CSS and Javascript support
  • Easy to port existing views
  • Have to write CSS to mimic Facebook UI
  • Lack of convenient FBML extensions
  • Using Iframe makes it easier to port to OpenSocial
  • r other social networks
slide-9
SLIDE 9

RFacebook

“RFacebook is a Ruby interface to the Facebook API. It hides all the nitty- gritty details behind a beautiful Ruby front-end, allowing you to focus on writing great code.”

slide-10
SLIDE 10

RFacebook on Rails

A plugin that provides controller, view, model and session extensions, as well as a simple debug panel.

  • require_facebook_install and require_facebook_login filters
  • fbsession object can make any API call
  • ex: fbsession.users_getInfo(:uids => [1234])
  • seamless routes: url_for, link_to, etc. are automatically relative

to http://apps.facebook.com when it detects that you are in the canvas.

  • acts_as_facebook_user
slide-11
SLIDE 11

Start coding

  • gem install rfacebook
  • script/plugin install svn://rubyforge.org/var/svn/

rfacebook/plugins/rfacebook_on_rails

  • rake facebook:setup
  • put your API key and your API secret in config/

facebook.yml

slide-12
SLIDE 12

The Facebook API

  • User information
  • Friend information
  • Photos
  • Publish to feed
  • Notifications
  • Profile box
  • And more... (groups, events, marketplace, etc.)
slide-13
SLIDE 13

Requiring install

  • RFacebook on Rails has

require_facebook_install and require_facebook_login methods

  • Require installs rather than just logins. It’s the

same amount of friction to the user

  • Will redirect to an install screen if app is not

installed

slide-14
SLIDE 14

fbsession

  • Uses method_missing, can make any API call
  • Populates common fields for you (api_key, session_key,

call_id, etc.), other parameters must be specified.

  • Use dot syntax for simple data access
  • response.hpricot to parse XML directly
slide-15
SLIDE 15

acts_as_facebook_user

  • Just add facebook_uid and facebook_session_id to

your user model

  • User.find_or_create_by_facebook_session(fbsession)
  • Uses method_missing to make API calls
  • user.first_name, user.pic, user.birthday, etc.
slide-16
SLIDE 16

Invites

  • Limit 20 per user per day
  • Effective, but challenging to motivate your users

to invite their friends

  • Now you have to use Facebook invite widget
  • Consider prompting users to invite friends right

before the payoff

  • Consider prompting users to invite friends
  • nce a day
slide-17
SLIDE 17

Profile box

  • Always comes up
  • Surprisingly, one of the most effective viral

channels

  • Build a great profile box
  • People love clicking on pictures
slide-18
SLIDE 18

Notifications

  • Spam metered
  • When a user clicks ‘X’, Facebook asks if they

want to hide this notifications, all notifications from this app, or if it’s spam.

  • Consider tracking your own notifications, with

a rolling timeout. Never send more than one notification to one user per week/month.

  • 5 email notifications per user per day
slide-19
SLIDE 19

Feeds

  • 98% of feeds don’t make it
  • Use feed templates to increase the likelihood

that your feeds will be seen

  • A/B test for effectiveness
slide-20
SLIDE 20

Application Directory

  • Hard to find, hard to navigate, yet it drives a

significant number of installs

  • Take care when naming and describing your app
slide-21
SLIDE 21

Be simple!

  • No if/thens
  • People love clicking and hate typing
  • Test the waters for initial viral acceptance, then

focus on engagement

slide-22
SLIDE 22

Follow the data

  • A/B Test
  • Track viral channels individually
  • Track your app, and keep an eye on fast

movers, with Appsaholic

  • Track your application adds by Facebook

referrer from the ‘More Stats’ page.

slide-23
SLIDE 23

Links

  • RFacebook - http://rfacebook.rubyforge.org
  • Intro at http://livelearncode.com/archives/14
  • Tutorial at http://www.liverail.net
  • http://developers.facebook.com
  • API docs, FBML docs, Wiki
  • http://www.facebook.com/developers
  • Developer community
  • Create and administer apps here
  • Subscribe to feeds