Your SlideShare is downloading. ×
Create a Force.com-Powered Facebook App on Heroku
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Create a Force.com-Powered Facebook App on Heroku

2,250

Published on

Heroku is ideally suited to creating applications on the Facebook platform. Indeed, as you will learn in this session, you can create a Heroku-backed Facebook app directly from within Facebook. With …

Heroku is ideally suited to creating applications on the Facebook platform. Indeed, as you will learn in this session, you can create a Heroku-backed Facebook app directly from within Facebook. With close to a billion users, Facebook is becoming the venue for the social enterprise's storefront. Integrate your salesforce or database.com data and now you have a truly social enterprise application. This session will teach you how to build a Facebook application using your choice of Ruby, PHP, Java, or Node.js on Heroku, integrating with data and processes in Force.com.

Presented at Cloudstock San Francisco, 2012.

Published in: Technology, Design
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,250
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
18
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Pre-session checklist: facebook dev page, workbench, Heroku home page, https://addons.heroku.com/
  • Show ‘Trust & Manage’ tab of Heroku website to see current number
  • Heroku makes cloud development simple
  • Create a default Facebook app in Heroku. git clone to retrieve source. Point out envvars for config, mogli for Facebook Graph API interactions.
  • Show ‘Charities’ tab in Cloudstock app in Force.com
  • Show workbench to query data
  • Copy over ‘stage 1’ source code. Point out oauth2 Ruby gem, new envvars for Force.com credentials, OAuth 2.0 log in, one line of code to pull charities from Force.com, code in index.erb to show charities. Commit, push to heroku, try running – oops!!! No values for envvars! Run script to set env vars. Try running again. Invite audience to hit app. Refresh app a few times. Explain how it’s likely a bit slow, since all traffic is being handled by a single dyno – let’s fix that right now by scaling it to 5 dynos.
  • Make a change to one of the charity’s logos then refresh to show that we do always see fresh data. Invite audience to hit app. Go to Force.com System Overview page and show API usage increasing as the page is hit.
  • Go to Herokuaddons page to point out Memcache add on.
  • AddMemcacheaddon, copy over ‘stage 2’ source code, point out use of Dalli Ruby gem for Memcache. Point out caching – charity data, plus access token/instance URL for Force.com. Point out cache flush code. Go to Force.com app, show trigger, cache flush method, update remote site setting, custom setting. Push new code. Invite audience to start hitting the app and watch the API Usage meter not change. Reverse the change we made earlier in Force.com and show that charity data is updated, and API usage incremented once.
  • Our brief says we need to integrate with approvals, so our Force.com app needs access to voting data, but where do we actually store it? Ask the audience – where should we store the votes?
  • Go to addons page and show levels of HerokuPostgres service.
  • Add shared-databaseaddon. Point out DataMapper usage, voting functionality – jQuery click handler posts vote to Ruby app
  • Refresh the page a few times as the votes come in. When audience is all done, show code in FB app to return vote counts. Go to Force.com and show code to pull vote counts, initiate approval. Go to VF page and show vote counts, click button to initiate approval, show record is locked for approval.
  • Transcript

    • 1. Create a Force.com-Powered Facebook App on Heroku Pat Patterson @metadaddy Principal Developer Evangelist salesforce.com
    • 2. Safe Harbor Statement“Safe harbor” statement under the Private Securities Litigation Reform Act of 1995: This presentation and the oral remarks thataccompany it contain forward-looking statements the achievement of which involves risks, uncertainties and assumptions. If anysuch risks or uncertainties materialize or if any of the assumptions proves incorrect, our results could differ materially from theresults expressed or implied by the forward-looking statements we make. All statements other than statements of historical factcould be deemed forward-looking, including any statements concerning new, planned or upgraded services or technologydevelopments, any projections of subscriber growth, earnings, revenues or other financial items and any statements regardingstrategies or plans of management for future operations, statements of belief and statements about future customer contracts orfuture customer use of our services.The risks and uncertainties referred to above include - but are not limited to - interruptions or delays in our service or our Webhosting; our ability to complete and successfully release new and improved versions of our on-demand platform and developmentenvironment; our new business model; problems integrating, launching or operating services based on newly acquired businessesor technologies, breach of our security measures; possible fluctuations in our operating results and rate of growth; the emergingmarket in which we operate; our relatively limited operating history; our ability to hire, retain and motivate our employees andmanage our growth; competition; our ability to continue to release and gain customer acceptance of new and improved versions ofour CRM service; unanticipated changes in our effective tax rate; fluctuations in the number of shares outstanding; the price ofsuch shares; foreign currency exchange rates and interest rates.Further information on these and other factors that could affect our financial results is included in the reports on Forms 10-K, 10-Qand 8-K and in other filings we make with the Securities and Exchange Commission from time to time, including our Form 10-K forthe fiscal year ended January 31, 2007. These documents are available on the SEC Filings section of the Investor Informationsection of our website at www.salesforce.com/investor.Any unreleased services or features referenced in this or other press releases or public statements are not currently available andmay not be delivered on time or at all. Customers who purchase our services should make purchase decisions based upon featuresthat are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-lookingstatements, except as required by law.
    • 3. Agenda• Brief overview of Heroku• Create a Facebook app with Heroku – Pull data from Force.com – Show some best practices – Give away some money!
    • 4. 1,250,000+ Apps Running on Heroku
    • 5. The Heroku Cloud Application PlatformRun AnythingForget Servers $ heroku create -s cedarDeploy Instantly $ git push heroku masterScale with EaseExtend with Add-ons
    • 6. Heroku and Facebook: Even Simpler!
    • 7. The Brief• Create a Facebook app to – Retrieve a list of charities from Force.com – Collect votes on charities – Restrict users to a single vote• Create a Force.com app to – Manage the list of charities – When the contest is over, initiate the approval process for a donation to the winning charity
    • 8. Charity App Back-end• Let’s look at how employees manage charities in Force.com
    • 9. Force.com REST API• Authenticate/authorize access via OAuth 2.0• Records in Force.com identified by URLs – /services/data/v24.0/sobjects/Charity__c/a0 0d0000002XU4r• CRUD via POST/GET/PATCH/DELETE• SOQL query interface – /services/data/v24.0/query?q=SELECT+Na me+FROM+Charity__c
    • 10. Step 1• Let’s extend our basic Facebook app to pull charity data from Force.com
    • 11. Efficiency• App gets charity data from Force.com on every page view – GOOD: data is timely – BAD: resource consumption, performance
    • 12. Best Practice• Let’s use Memcache to store charity data – Facebook app loads cache from Force.com – Force.com trigger flushes cache on any change
    • 13. Step 2• Add Memcacheaddon• Store charity data in Memcache• Configure Force.com app to flush cache on any change to charity data
    • 14. Let’s Get Voting!• But where do we store votes?
    • 15. HerokuPostgres• Managed SQL database• Free shared-database addon for development• Several tiers of paid service for production
    • 16. Step 3• Store votes in Postgres• Expose vote totals via RESTful Web service• Integrate with approval process in Force.com
    • 17. Vote• Insert Heroku app URL here!
    • 18. Conclusion• Use Heroku for your high-volume Facebook apps• Use the Force.com REST API to integrate external apps with Force.com• Integration is straightforward, but follow best practices to get a great result!
    • 19. Resources www.heroku.com/facebook developer.force.com/RESTworkbench.developerforce.com bit.ly/cs12-facebook

    ×