Facebook Mobile Hack Crash Course: Singapore 19th March 2012
Facebook Mobile Hack Crash Course: Singapore 19th March 2012
Singapore th March
Crash Course
Jonathan Matus Christine Abernathy
Social applications
Jargon-Busting
Understanding the Facebook Product
TimeLine
TimeLine
Facebook Platform
Pages Canvas
Social plugins
Mobile
Open Graph
Credits
Ads
Insights
Facebook Platform
Pages Canvas
Social plugins
Mobile
Open Graph
Credits
Ads
Insights
GDP Authentication
user_about_me user_activities user_checkins user_education_history rsvp_event user_events create_event user_groups user_hometown user_likes user_interests
user_education_history rsvp_event user_events create_event user_groups user_hometown user_likes user_interests user_notes user_photo_video_tags user_photos user_questions email
user_likes user_interests user_notes user_photo_video_tags user_photos user_questions email user_relationships user_relationship_details user_religion_politics user_status user_videos user_website
user_relationship_details user_religion_politics user_status user_videos user_website user_work_history user_location user_birthday friends_about_me friends_activities friends_birthday friends_checkins friends_education_history
user_birthday friends_about_me friends_activities friends_birthday friends_checkins friends_education_history publish_actions publish_stream friends_events friends_groups friends_hometown friends_interests friends_likes
friends_photo_video_tags friends_photos friends_questions friends_relationships user_actions:{app_namespace} friends_actions:{app_namespace} user_actions.music friends_actions.music friends_relationship_details friends_religion_politics friends_status friends_videos friends_website
read_insights read_mailbox read_requests read_stream xmpp_login ads_management manage_friendlists manage_notications user_online_presence friends_online_presence publish_checkins
Plugins
Plugins
https://developers.facebook.com/docs/plugins/
Plugins
https://developers.facebook.com/docs/plugins/
Plugins: creation
<iframe>
<iframe src="//www.facebook.com/plugins/like.php? href=https%3A%2F%2Ffanyv88.com%3A443%2Fhttp%2Ftripleodeon.com &send=false &layout=standard &width=450 &show_faces=true &action=like &colorscheme=light &appId=177774888997202" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;" ></iframe>
SDKs
SDKs
https://github.com/facebook...
/facebook-js-sdk
/facebook-php-sdk
/facebook-android-sdk /facebook-ios-sdk
JavaScript
<div id="fb-root"></div> <script> window.fbAsyncInit = function() {FB.init({appId: 'APP_ID'});}; (function(d){ var js, id='facebook-jssdk', ref=d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); </script>
JavaScript
FB.login(function(response) { if (response.authResponse) { console.log('Welcome! Fetching your information...'); FB.api('/me', function(response) { console.log('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not authorize.'); } });
SDK is also used to support the plugins and (desktop) canvas apps
PHP
require_once("facebook.php"); $facebook = new Facebook(array('appId' => 'APP_ID', 'secret' => 'APP_SECRET')); $loginUrl = $facebook->getLoginUrl(array( 'scope' => 'read_stream, friends_likes', 'redirect_uri' => 'https://www.myapp.com/post_login_page' )); ... $user_profile = $facebook->api('/me'); echo "Name: " . $user_profile['name'];
App Manager
https://developers.facebook.com/apps
Tools
https://developers.facebook.com/tools/explorer
Graph API
Graph API
GET https://graph.facebook.com/738229837 { "id": "738229837", "name": "James Pearce", "first_name": "James", "last_name": "Pearce", "hometown": { "id": "106078429431815", "name": "London, United Kingdom" }, "location": { "name": "Palo Alto, California" ... https://developers.facebook.com/docs/reference/api/
Graph API
GET https://graph.facebook.com/738229837/checkins { "data": [ { "id": "10150835326849838", "from": { "name": "James Pearce", "id": "738229837" }, "message": "Warm and productive in London...", "place": { "id": "109599872410687", "name": "Facebook London"...
Graph API
$facebook->api('/738229837/checkins', 'POST', array( 'access_token' => $facebook->getAccessToken(), 'place' => '109599872410687', 'message' => 'Sitting at work', 'coordinates' => json_encode(array( ... )) ) );
FQL
SELECT name FROM user WHERE uid = me()
SELECT name, pic_square FROM user WHERE uid = me() OR uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() )
https://developers.facebook.com/docs/reference/fql/
FQL
GET https://graph.facebook.com/fql? q=SELECT+name+FROM+user+WHERE+uid+=+me() &access_token=...
https://developers.facebook.com/docs/reference/fql/
Open Graph
Open Graph
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# castline: http://ogp.me/ns/fb/castline#"> <meta <meta <meta <meta <meta <meta property="fb:app_id" content="678678" /> property="og:type" content="castline:podcast" /> property="og:url" content="http://myapp.com/12345" /> property="og:title" content="My Podcast" /> property="og:description" content="Cool podcast" /> property="og:image" content="http://..." />
Open Graph
GET
https://graph.facebook.com/me/castline:listen_to? access_token=...
Thanks