SlideShare a Scribd company logo
1 of 74
Download to read offline
So you want to build
a Facebook app
Facebook Developer Garage Kuala Lumpur
Kamal Fariz, RSB
Basic Ingredients
http://www.facebook.com/apps/application.php?id=2345053339
Ruby on Rails
rfacebook gem
STEP 1

Setup a new application
STEP 2

Create a Rails app
A full-stack framework for
developing database-backed
web applications according
to the Model-View-Controller
pattern.
A full-stack framework for
developing database-backed
web applications according
to the Model-View-Controller
             A bunch of stuff that
            makes web developers
                    happy!
pattern.

       - David Heinemeier Hansson   http://flickr.com/photos/pragdave/174964316/
MacBook-Pro:~ kamal$ rails super_gifts
MacBook-Pro:~   kamal$ rails super_gifts
      create
      create    app/controllers
      create    app/controllers/application.rb
      create    app/helpers/application_helper.rb
      create    test/test_helper.rb
      create    config/database.yml
      create    config/routes.rb
      ...
      create    public/images/rails.png
      create    public/javascripts/prototype.js
      create    public/javascripts/effects.js
      create    public/javascripts/dragdrop.js
      create    public/javascripts/controls.js
      create    public/javascripts/application.js
      create    doc/README_FOR_APP
      create    log/server.log
      create    log/production.log
      create    log/development.log
      create    log/test.log
MacBook-Pro:~   kamal$
MacBook-Pro:~ kamal$ gem install rfacebook
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$ cd super_gifts/
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$ cd super_gifts/
MacBook-Pro:super_gifts kamal$
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$ cd super_gifts/
MacBook-Pro:super_gifts kamal$ ./script/plugin install
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$ cd super_gifts/
MacBook-Pro:super_gifts kamal$ ./script/plugin install 
http://rfacebook.rubyforge.org/svn/trunk/rfacebook/
MacBook-Pro:~ kamal$ gem install rfacebook
Successfully installed rfacebook-0.9.8
1 gem installed
Installing ri documentation for rfacebook-0.9.8...
Installing RDoc documentation for rfacebook-0.9.8...
MacBook-Pro:~ kamal$ cd super_gifts/
MacBook-Pro:super_gifts kamal$ ./script/plugin install 
http://rfacebook.rubyforge.org/svn/trunk/rfacebook/
+ ./README
+ ./Rakefile
+ ./lib/facebook_desktop_session.rb
+ ./lib/facebook_session.rb
+ ./lib/facebook_web_session.rb
...
+ ./test/facebook_web_session_test.rb
+ ./test/test_helper.rb
MacBook-Pro:super_gifts kamal$
MacBook-Pro:super_gifts kamal$ rake facebook:setup
MacBook-Pro:super_gifts kamal$ rake facebook:setup
(in /Users/kamal/super_gifts)
======================================================
Setting up RFacebook on Rails Plugin
  [1] Created config/facebook.yml <-- BE SURE TO CHANGE
THE API KEY AND SECRET
Done.
======================================================
MacBook-Pro:super_gifts kamal$
development:
  key: YOUR_API_KEY_HERE
  secret: YOUR_API_SECRET_HERE
  canvas_path: /yourAppName/
  callback_path: /path/to/your/callback/
  tunnel:
    username: yourLoginName
    host: www.yourexternaldomain.com
    port: 1234
    local_port: 5678




config/facebook.yml
development:
  key: c6578c8b63873881caad22fccfe2715b
  secret: 6b3f1f580409cd487f431e22923f00ad
  canvas_path: /super_gifts/
  callback_path: /
  tunnel:
    username: kamal
    host: deploy.ror.com.my
    port: 8080
    local_port: 3000




config/facebook.yml
MacBook-Pro:super_gifts kamal$ rake facebook:tunnel:start
MacBook-Pro:super_gifts kamal$ rake facebook:tunnel:start
(in /Users/kamal/super_gifts)
======================================================
Tunneling deploy.ror.com.my:8080 to 0.0.0.0:3000

NOTES:
* ensure that you have Rails running on your local machine at port 3000
* once logged in to the tunnel, you can visit http://deploy.ror.com.my:8080 to
view your site
* use ctrl-c to quit the tunnel
* if you have problems creating the tunnel, you may need to add the following
to /etc/ssh/sshd_config on your server:

GatewayPorts clientspecified

* if you have problems with deploy.ror.com.my timing out your ssh connection,
add the following lines to your '~/.ssh/config' file:

Host deploy.ror.com.my
  ServerAliveInterval 120

======================================================
MacBook-Pro:super_gifts kamal$ ./script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for
options
[2008-03-14 16:38:07] INFO WEBrick 1.3.1
[2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23)
[i686-darwin9.0.0]
[2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start:
pid=68088 port=3000
What happens when you
access an app?
http://apps.facebook.com/super_gifts
MacBook-Pro:super_gifts kamal$ ./script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-03-14 16:38:07] INFO WEBrick 1.3.1
[2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23) [i686-
darwin9.0.0]
[2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start:
pid=68088 port=3000
MacBook-Pro:super_gifts kamal$ ./script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-03-14 16:38:07] INFO WEBrick 1.3.1
[2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23) [i686-
darwin9.0.0]
[2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start:
pid=68088 port=3000
Making things look right
FBML
<fb:name uid=quot;508258787quot; />   => you
<fb:name uid=quot;508258787quot; />                     => you
<fb:name uid=quot;508258787quot; capitalize=quot;truequot; />   => You
<fb:name uid=quot;508258787quot; />                     => you
<fb:name uid=quot;508258787quot; capitalize=quot;truequot; />   => You
<fb:name uid=quot;508258787quot; possessive=quot;truequot; />   => Your
<fb:name   uid=quot;508258787quot;   />                     =>   you
<fb:name   uid=quot;508258787quot;   capitalize=quot;truequot; />   =>   You
<fb:name   uid=quot;508258787quot;   possessive=quot;truequot; />   =>   Your
<fb:name   uid=quot;508258787quot;   reflexive=quot;truequot; />    =>   Yourself
<fb:name   uid=quot;508258787quot;   />                     =>   you
<fb:name   uid=quot;508258787quot;   capitalize=quot;truequot; />   =>   You
<fb:name   uid=quot;508258787quot;   possessive=quot;truequot; />   =>   Your
<fb:name   uid=quot;508258787quot;   reflexive=quot;truequot; />    =>   Yourself
<fb:name   uid=quot;508258787quot;   useyou=quot;falsequot; />      =>   Kamal Fariz Mahyuddin
<fb:name   uid=quot;508258787quot;   />                     =>   you
<fb:name   uid=quot;508258787quot;   capitalize=quot;truequot; />   =>   You
<fb:name   uid=quot;508258787quot;   possessive=quot;truequot; />   =>   Your
<fb:name   uid=quot;508258787quot;   reflexive=quot;truequot; />    =>   Yourself
<fb:name   uid=quot;508258787quot;   useyou=quot;falsequot; />      =>   Kamal Fariz Mahyuddin
<fb:name   uid=quot;510442171quot;   />                     =>   Daniel CerVentus
<fb:name   uid=quot;508258787quot;   />                        =>   you
<fb:name   uid=quot;508258787quot;   capitalize=quot;truequot; />      =>   You
<fb:name   uid=quot;508258787quot;   possessive=quot;truequot; />      =>   Your
<fb:name   uid=quot;508258787quot;   reflexive=quot;truequot; />       =>   Yourself
<fb:name   uid=quot;508258787quot;   useyou=quot;falsequot; />         =>   Kamal Fariz Mahyuddin
<fb:name   uid=quot;510442171quot;   />                        =>   Daniel CerVentus
<fb:name   uid=quot;510442171quot;   firstnameonly=quot;truequot; />   =>   Daniel
<fb:user-table cols=quot;3quot;>
   <fb:user-item uid=quot;508258787quot;   />
   <fb:user-item uid=quot;510442171quot;   />
   <fb:user-item uid=quot;780410586quot;   />
   <fb:user-item uid=quot;544248752quot;   />
   <fb:user-item uid=quot;543101914quot;   />
</fb:user-table>
<fb:comments xid=quot;super_gift_commentsquot; canpost=quot;truequot; returnurl=quot;http://apps.facebook.com/super_giftsquot;>
  <fb:title>The Wall</fb:title>
</fb:comments>
FBML Test Console
http://developers.facebook.com/tools.php?fbml
Making things act right
API
fbsession.friends_get


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<friends_get_response ... list=quot;truequot;>
  <uid>400156</uid>
  <uid>1906543</uid>
  <uid>5404778</uid>
  <uid>8602139</uid>
  ...
  <uid>5404778</uid>
  <uid>8602139</uid>
</friends_get_response>
fbsession.notifications_send(:to_ids => ['400156', '1906543'],
  :notification => message)
API Test Console
http://developers.facebook.com/tools.php?api
STEP 3

PROFIT!!!111!!!1!!
Resources
Hosting - Joyent Accelerator for Facebook Developers
http://www.joyent.com/developers/facebook/

Facebook Developers Wiki
http://wiki.developers.facebook.com/

FBML Test Console
http://developers.facebook.com/tools.php?fbml

API Test Console
http://developers.facebook.com/tools.php?api

Ruby on Rails
http://www.rubyonrails.org/

rfacebook
http://rfacebook.rubyforge.org/

facebooker
http://facebooker.rubyforge.org/
Malaysia.rb
Malaysia Ruby Brigade
106 people in Google Groups
53 people in Facebook Group
Meets every third Thursday
of the month
Malaysia.rb 3rd Meetup
July 2007
http://groups.google.com/group/malaysia-rb

More Related Content

What's hot

Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
Byrne Reese
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
jsmith92
 
LESS is More
LESS is MoreLESS is More
LESS is More
jsmith92
 
シックス・アパート・フレームワーク
シックス・アパート・フレームワークシックス・アパート・フレームワーク
シックス・アパート・フレームワーク
Takatsugu Shigeta
 
Html5 and beyond the next generation of mobile web applications - Touch Tou...
Html5 and beyond   the next generation of mobile web applications - Touch Tou...Html5 and beyond   the next generation of mobile web applications - Touch Tou...
Html5 and beyond the next generation of mobile web applications - Touch Tou...
RIA RUI Society
 
2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcamp
Brandon Dove
 

What's hot (20)

Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Dress Your WordPress with Child Themes
Dress Your WordPress with Child ThemesDress Your WordPress with Child Themes
Dress Your WordPress with Child Themes
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
Html5的应用与推行
Html5的应用与推行Html5的应用与推行
Html5的应用与推行
 
How to Issue and Activate Free SSL using Let's Encrypt
How to Issue and Activate Free SSL using Let's EncryptHow to Issue and Activate Free SSL using Let's Encrypt
How to Issue and Activate Free SSL using Let's Encrypt
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blog
 
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
 
シックス・アパート・フレームワーク
シックス・アパート・フレームワークシックス・アパート・フレームワーク
シックス・アパート・フレームワーク
 
Contributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter WilsonContributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter Wilson
 
Mobile Web Performance - Getting and Staying Fast
Mobile Web Performance -  Getting and Staying FastMobile Web Performance -  Getting and Staying Fast
Mobile Web Performance - Getting and Staying Fast
 
High-Quality JavaScript
High-Quality JavaScriptHigh-Quality JavaScript
High-Quality JavaScript
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Nahlédněte za oponu VersionPressu
Nahlédněte za oponu VersionPressuNahlédněte za oponu VersionPressu
Nahlédněte za oponu VersionPressu
 
Html5 and beyond the next generation of mobile web applications - Touch Tou...
Html5 and beyond   the next generation of mobile web applications - Touch Tou...Html5 and beyond   the next generation of mobile web applications - Touch Tou...
Html5 and beyond the next generation of mobile web applications - Touch Tou...
 
2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcamp
 
جيفيرا باي الساحل الشمالي
جيفيرا باي الساحل الشماليجيفيرا باي الساحل الشمالي
جيفيرا باي الساحل الشمالي
 

Similar to So you want to build a Facebook app

So you want to build a facebook App ?
So you want to build a facebook App ?So you want to build a facebook App ?
So you want to build a facebook App ?
Nguyễn Duy Nhân
 
Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with Ruby
Lindsay Holmwood
 
Create and Deploy Ember in 5 Minutes with Middleman
Create and Deploy Ember in 5 Minutes with MiddlemanCreate and Deploy Ember in 5 Minutes with Middleman
Create and Deploy Ember in 5 Minutes with Middleman
Ross Kaffenberger
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
Joao Lucas Santana
 
yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909
Yusuke Wada
 
Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 

Similar to So you want to build a Facebook app (20)

So you want to build a facebook App ?
So you want to build a facebook App ?So you want to build a facebook App ?
So you want to build a facebook App ?
 
Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with Ruby
 
Create and Deploy Ember in 5 Minutes with Middleman
Create and Deploy Ember in 5 Minutes with MiddlemanCreate and Deploy Ember in 5 Minutes with Middleman
Create and Deploy Ember in 5 Minutes with Middleman
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
 
Capistrano
CapistranoCapistrano
Capistrano
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
 
MySQL crash course by moshe kaplan
MySQL crash course by moshe kaplanMySQL crash course by moshe kaplan
MySQL crash course by moshe kaplan
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909yusukebe in Yokohama.pm 090909
yusukebe in Yokohama.pm 090909
 
Love The Terminal
Love The TerminalLove The Terminal
Love The Terminal
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentation
 
August 10th, 2009 Pete De Mulle Twitter
August 10th, 2009 Pete De Mulle TwitterAugust 10th, 2009 Pete De Mulle Twitter
August 10th, 2009 Pete De Mulle Twitter
 
FVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / WidgetsFVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / Widgets
 
Spyware/Malware FVCP
Spyware/Malware  FVCPSpyware/Malware  FVCP
Spyware/Malware FVCP
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605
 

More from kamal.fariz (10)

Entrepreneur + Developer Gangbang: Co-working
Entrepreneur + Developer Gangbang: Co-workingEntrepreneur + Developer Gangbang: Co-working
Entrepreneur + Developer Gangbang: Co-working
 
The Malaysian Free Software Movement 2008
The Malaysian Free Software Movement 2008The Malaysian Free Software Movement 2008
The Malaysian Free Software Movement 2008
 
Impact of Higher Mathematics on the World Wide Web
Impact of Higher Mathematics on the World Wide WebImpact of Higher Mathematics on the World Wide Web
Impact of Higher Mathematics on the World Wide Web
 
Life of a GSoC Student
Life of a GSoC StudentLife of a GSoC Student
Life of a GSoC Student
 
Design For Developers
Design For DevelopersDesign For Developers
Design For Developers
 
SearchMonkey - Monkeying Around With Search
SearchMonkey - Monkeying Around With SearchSearchMonkey - Monkeying Around With Search
SearchMonkey - Monkeying Around With Search
 
RIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on RailsRIA Development via Adobe Flex + JRuby on Rails
RIA Development via Adobe Flex + JRuby on Rails
 
Content Delivery Network
Content Delivery NetworkContent Delivery Network
Content Delivery Network
 
Web Development with Ruby on Rails, MyGOSSCON 2007
Web Development with Ruby on Rails, MyGOSSCON 2007Web Development with Ruby on Rails, MyGOSSCON 2007
Web Development with Ruby on Rails, MyGOSSCON 2007
 
Acunote vs. Mingle
Acunote vs. MingleAcunote vs. Mingle
Acunote vs. Mingle
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

So you want to build a Facebook app

  • 1. So you want to build a Facebook app Facebook Developer Garage Kuala Lumpur Kamal Fariz, RSB
  • 6. STEP 1 Setup a new application
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. STEP 2 Create a Rails app
  • 19. A full-stack framework for developing database-backed web applications according to the Model-View-Controller pattern.
  • 20. A full-stack framework for developing database-backed web applications according to the Model-View-Controller A bunch of stuff that makes web developers happy! pattern. - David Heinemeier Hansson http://flickr.com/photos/pragdave/174964316/
  • 22. MacBook-Pro:~ kamal$ rails super_gifts create create app/controllers create app/controllers/application.rb create app/helpers/application_helper.rb create test/test_helper.rb create config/database.yml create config/routes.rb ... create public/images/rails.png create public/javascripts/prototype.js create public/javascripts/effects.js create public/javascripts/dragdrop.js create public/javascripts/controls.js create public/javascripts/application.js create doc/README_FOR_APP create log/server.log create log/production.log create log/development.log create log/test.log MacBook-Pro:~ kamal$
  • 23. MacBook-Pro:~ kamal$ gem install rfacebook
  • 24. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$
  • 25. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$ cd super_gifts/
  • 26. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$ cd super_gifts/ MacBook-Pro:super_gifts kamal$
  • 27. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$ cd super_gifts/ MacBook-Pro:super_gifts kamal$ ./script/plugin install
  • 28. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$ cd super_gifts/ MacBook-Pro:super_gifts kamal$ ./script/plugin install http://rfacebook.rubyforge.org/svn/trunk/rfacebook/
  • 29. MacBook-Pro:~ kamal$ gem install rfacebook Successfully installed rfacebook-0.9.8 1 gem installed Installing ri documentation for rfacebook-0.9.8... Installing RDoc documentation for rfacebook-0.9.8... MacBook-Pro:~ kamal$ cd super_gifts/ MacBook-Pro:super_gifts kamal$ ./script/plugin install http://rfacebook.rubyforge.org/svn/trunk/rfacebook/ + ./README + ./Rakefile + ./lib/facebook_desktop_session.rb + ./lib/facebook_session.rb + ./lib/facebook_web_session.rb ... + ./test/facebook_web_session_test.rb + ./test/test_helper.rb MacBook-Pro:super_gifts kamal$
  • 31. MacBook-Pro:super_gifts kamal$ rake facebook:setup (in /Users/kamal/super_gifts) ====================================================== Setting up RFacebook on Rails Plugin [1] Created config/facebook.yml <-- BE SURE TO CHANGE THE API KEY AND SECRET Done. ====================================================== MacBook-Pro:super_gifts kamal$
  • 32. development: key: YOUR_API_KEY_HERE secret: YOUR_API_SECRET_HERE canvas_path: /yourAppName/ callback_path: /path/to/your/callback/ tunnel: username: yourLoginName host: www.yourexternaldomain.com port: 1234 local_port: 5678 config/facebook.yml
  • 33.
  • 34.
  • 35. development: key: c6578c8b63873881caad22fccfe2715b secret: 6b3f1f580409cd487f431e22923f00ad canvas_path: /super_gifts/ callback_path: / tunnel: username: kamal host: deploy.ror.com.my port: 8080 local_port: 3000 config/facebook.yml
  • 36. MacBook-Pro:super_gifts kamal$ rake facebook:tunnel:start
  • 37. MacBook-Pro:super_gifts kamal$ rake facebook:tunnel:start (in /Users/kamal/super_gifts) ====================================================== Tunneling deploy.ror.com.my:8080 to 0.0.0.0:3000 NOTES: * ensure that you have Rails running on your local machine at port 3000 * once logged in to the tunnel, you can visit http://deploy.ror.com.my:8080 to view your site * use ctrl-c to quit the tunnel * if you have problems creating the tunnel, you may need to add the following to /etc/ssh/sshd_config on your server: GatewayPorts clientspecified * if you have problems with deploy.ror.com.my timing out your ssh connection, add the following lines to your '~/.ssh/config' file: Host deploy.ror.com.my ServerAliveInterval 120 ======================================================
  • 38. MacBook-Pro:super_gifts kamal$ ./script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2008-03-14 16:38:07] INFO WEBrick 1.3.1 [2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23) [i686-darwin9.0.0] [2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start: pid=68088 port=3000
  • 39. What happens when you access an app?
  • 41.
  • 42.
  • 43. MacBook-Pro:super_gifts kamal$ ./script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2008-03-14 16:38:07] INFO WEBrick 1.3.1 [2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23) [i686- darwin9.0.0] [2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start: pid=68088 port=3000
  • 44. MacBook-Pro:super_gifts kamal$ ./script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2008-03-14 16:38:07] INFO WEBrick 1.3.1 [2008-03-14 16:38:07] INFO ruby 1.8.6 (2007-09-23) [i686- darwin9.0.0] [2008-03-14 16:38:07] INFO WEBrick::HTTPServer#start: pid=68088 port=3000
  • 45.
  • 46.
  • 47.
  • 49. FBML
  • 51. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You
  • 52. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You <fb:name uid=quot;508258787quot; possessive=quot;truequot; /> => Your
  • 53. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You <fb:name uid=quot;508258787quot; possessive=quot;truequot; /> => Your <fb:name uid=quot;508258787quot; reflexive=quot;truequot; /> => Yourself
  • 54. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You <fb:name uid=quot;508258787quot; possessive=quot;truequot; /> => Your <fb:name uid=quot;508258787quot; reflexive=quot;truequot; /> => Yourself <fb:name uid=quot;508258787quot; useyou=quot;falsequot; /> => Kamal Fariz Mahyuddin
  • 55. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You <fb:name uid=quot;508258787quot; possessive=quot;truequot; /> => Your <fb:name uid=quot;508258787quot; reflexive=quot;truequot; /> => Yourself <fb:name uid=quot;508258787quot; useyou=quot;falsequot; /> => Kamal Fariz Mahyuddin <fb:name uid=quot;510442171quot; /> => Daniel CerVentus
  • 56. <fb:name uid=quot;508258787quot; /> => you <fb:name uid=quot;508258787quot; capitalize=quot;truequot; /> => You <fb:name uid=quot;508258787quot; possessive=quot;truequot; /> => Your <fb:name uid=quot;508258787quot; reflexive=quot;truequot; /> => Yourself <fb:name uid=quot;508258787quot; useyou=quot;falsequot; /> => Kamal Fariz Mahyuddin <fb:name uid=quot;510442171quot; /> => Daniel CerVentus <fb:name uid=quot;510442171quot; firstnameonly=quot;truequot; /> => Daniel
  • 57. <fb:user-table cols=quot;3quot;> <fb:user-item uid=quot;508258787quot; /> <fb:user-item uid=quot;510442171quot; /> <fb:user-item uid=quot;780410586quot; /> <fb:user-item uid=quot;544248752quot; /> <fb:user-item uid=quot;543101914quot; /> </fb:user-table>
  • 58. <fb:comments xid=quot;super_gift_commentsquot; canpost=quot;truequot; returnurl=quot;http://apps.facebook.com/super_giftsquot;> <fb:title>The Wall</fb:title> </fb:comments>
  • 61. API
  • 62. fbsession.friends_get <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <friends_get_response ... list=quot;truequot;> <uid>400156</uid> <uid>1906543</uid> <uid>5404778</uid> <uid>8602139</uid> ... <uid>5404778</uid> <uid>8602139</uid> </friends_get_response>
  • 63. fbsession.notifications_send(:to_ids => ['400156', '1906543'], :notification => message)
  • 67. Hosting - Joyent Accelerator for Facebook Developers http://www.joyent.com/developers/facebook/ Facebook Developers Wiki http://wiki.developers.facebook.com/ FBML Test Console http://developers.facebook.com/tools.php?fbml API Test Console http://developers.facebook.com/tools.php?api Ruby on Rails http://www.rubyonrails.org/ rfacebook http://rfacebook.rubyforge.org/ facebooker http://facebooker.rubyforge.org/
  • 68.
  • 69.
  • 71. 106 people in Google Groups 53 people in Facebook Group
  • 72. Meets every third Thursday of the month