Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (32 sloc) 1.64 KB

Facebook RealTime

Facebook RealTime is a rails wrapper around facebook Real-time Update API.

Facebook Real-Time Update API

Facebook Graph API

For an overview of what this is all about, see


Create new Controller

Controller must inherit FacebookRealTime::SubscriptionsController

  • facebook_check is a callback URL to which Facebook will get subscription validation.

  • facebook_update is callback URL to which Facebook will post subscription updates.

Add two routes :get and :post

open your routes.rb and add

  • match '/endpoint' => 'controller_name#facebook_check', :via => [:get]

  • match '/endpoint' => 'controller_name#facebook_update', :via => [:post]

Create variables :

  • FB['id'] : facebook application id

  • FB['secret'] : facebook application secret

  • FB['verify_token'] : A subscriber-provided opaque token that will be echoed back in the verification request to assist the subscriber in identifying which subscription request is being verified. If this is not included, no token will be included in the verification request. This is from the PubSubHubbub spec.

Deploy your app

Before using gem you have to deploy a valid check method, to add new subscriptions

Use rake tasks :

  • rake fb:rt:list to show your subscriptions

  • rake fb:rt:delete to delete all your subscription

  • rake fb:rt:subscribe to add or a modify a subscription

  • params

    • object

      • facebook object name eg : user, …

    • fields:

      • list of fields with ',' as separator eg : “likes, info”

    • callback_url:

      • url bringing to your check method

Jump to Line
Something went wrong with that request. Please try again.