Raw Notes: Facebook for Devs

Wednesday, February 29, 2012 / Posted by Luke Puplett /

Raw notes, unedited.




Curate Identities

Social Graph – Model of users and objects and interactions.

Social Channels – Mechanisms apps to reach users. News feeds. App requests. Bookmarks.

Social Plugins – Facebook UI directly exposed in app.

Graph API & FQL – Authenticate and grant (OAuth?) and then app can interact.

Pages and Page Tabs – tabs are iframes, often hosting Page Tab Apps. These are the good looking pages you see, like Coke.

Canvas App – App inside Facebook site chrome.

Social Graph

Mike -> Likes -> Page
Mike -> Plays -> Game
Mike -> Checked-into -> Thing
Mike -> Friends -> Dave
Dave -> Likes -> Page

Apps can access the social graph.

Facebook Apps

Create an app, like Twitter.

Apps are hosted on your own infrastructure, code runs on your box.

Authentication using Facebook is OAuth.

Canvas Apps get a POST to callback URL with parameter with JSON of the user account.

App namespace is the bit after the facebook.com/yournamespace

Your URLs are just the root (base) and can have stuff after, like mydomain.com/fb/somethingelse/blah/2

Social Plugins

Like Button

Login – login to site and authenticate on your site via Facebook.

Registration – similar to above.

Activity Feed and Recommendations – Friends and Pages that their friends have interacted with on your website.

Like Box – Include on site a button to allow a user to Like your Facebook page.

Facepile – Faces of user’s friends that have already liked the site.

Live Stream – Webcast interaction, comments.

Send button – Send link to page to Facebook friends.

Page needs meta properties – http://ogp.me/ns#

E.g. <meta property=”og:title” content=”My Social Plugins” />

Facebook Insights works with fb:app_id or fog:app_id (look it up) meta tag.

Need to us FB JavaScript SDK.


Feed – Post to timeline from within app/site.

Send – Send message to friends using FB messaging.

Requests – Send request to friends from any site, but brings them back to Canvas app.

Graph API

graph.facebook.com REST API

Objects have unique IDs as string, so GET graph.facebook.com/id would fetch it, as would /?ids=id1,id2

Some objects have an id that is a URL itself, GET graph.facebook.com/?ids=http://blah.com

?fields=id,name,location can limited or expand fields returned, since=unixtime&until=unixtime

?metadata=1 gives list of object fields and object connections, which can be used to drill down.

?limit=3 takes the top n results.

?offset=100&limit=50 is paging control.

Can batch API calls in one call. See FB docs.

Realtime Updates also available.

Creating Objects

Create an object by adding it to a collection, using the object id and connection that represents the collection you’re adding to, e.g. POST to /me/events with event parameters where events is the connection (collection).

Graph Explorer at developers.facebook.com is awesome tool for understanding formats, security and possibilities.

FQL gives SELECT as in /fql?q=SELECT name FROM user WHERE uid = 16416123


Dates returned in ISO-8601

Can specify date_format

date_format=U for Unix
date_format=r for Thu, 17 Nov 2011 18:00:16 +0000

Graph API default timezone is UTC, but FQL is PST (UTC-8)

Labels: , ,


Post a Comment