Social Apps with the Force.comToolkit for FacebookPat Patterson, salesforce.com, Principal Developer Evangelist@metadaddy
Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contai...
Pat PattersonPrincipal Developer Evangelist@metadaddy
Objectives Understand the Facebook Graph API Be able to use the Force.com Toolkit for Facebook in an app Understand how us...
Agenda The Facebook Graph API The Force.com Toolkit for Facebook Social Sign-On with Authentication Providers Create a soc...
The Facebook Graph API       https://developers.facebook.com/docs/reference/api/
Accessing Social Graph Objects Every social graph object has a unique ID   https://graph.facebook.com/ID For example, ‘Fa...
Relationships – Edges on the Graph Friends, feed (wall/timeline), likes, photos, videos, etc Graph API terminology: connec...
Graph API Authorization OAuth 2.0   Redirect to Facebook; user authenticates (if necessary) and gives    permission for a...
Graph API Permissions Access to specific types of graph objects is controlled by permissions   user_likes, friends_photos...
Searching GET https://graph.facebook.com/search?q=force.com&type=post
Publishing HTTP POST to a connection URL   Access token is required!   curl -F access_token=...        -F message=Hello ...
Graph API Explorer        https://developers.facebook.com/tools/explorer
Force.com Toolkit for Facebook http://wiki.developerforce.com/page/Facebook_Toolkit Apex binding for the Facebook Graph AP...
Force.com Toolkit for Facebook Graph API objects modeled as Apex classes   FacebookUser, FacebookPhoto etc  <apex:page co...
Social Sign-On from Facebook toCustomer Portal Authentication Provider   Built into Force.com Platform   Performs ‘app’ ...
Leveraging the Social Graph How do we get our customer portal to ‘go viral’?   Allow users to invite their friends   Sup...
Building a Social App Want to (optionally) publish a link to the user’s wall when they close a case – encourage more frien...
Getting an Access Token – Customer Portal  public class MyPageController {       private static String authProviderId = //...
One Shortcoming with Authentication Provider scope is fixed to email   email address + ‘basic info’ (friends list etc) Ri...
Widening ScopeWorkaround for fixed scope    Use Facebook JavaScript SDK to request additional permissions   // We need so...
Wrapping Up The Facebook JavaScript SDK and Dialogs allow simple social actions from Visualforce The Force.com Toolkit for...
Go out and build something cool!
Pat PattersonPrincipal Developer Evangelist,         @metadaddy
Social Apps with the Force.com Toolkit for Facebook
Upcoming SlideShare
Loading in...5
×

Social Apps with the Force.com Toolkit for Facebook

757

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
757
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Social Apps with the Force.com Toolkit for Facebook

  1. 1. Social Apps with the Force.comToolkit for FacebookPat Patterson, salesforce.com, Principal Developer Evangelist@metadaddy
  2. 2. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward- looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  3. 3. Pat PattersonPrincipal Developer Evangelist@metadaddy
  4. 4. Objectives Understand the Facebook Graph API Be able to use the Force.com Toolkit for Facebook in an app Understand how users can use their Facebook identity to login to Salesforce
  5. 5. Agenda The Facebook Graph API The Force.com Toolkit for Facebook Social Sign-On with Authentication Providers Create a social application on Force.com  Login from Facebook  Share with friends  Post to timeline
  6. 6. The Facebook Graph API https://developers.facebook.com/docs/reference/api/
  7. 7. Accessing Social Graph Objects Every social graph object has a unique ID  https://graph.facebook.com/ID For example, ‘Facebook Platform’ has ID 19292868552  GET https://graph.facebook.com/19292868552
  8. 8. Relationships – Edges on the Graph Friends, feed (wall/timeline), likes, photos, videos, etc Graph API terminology: connections  https://graph.facebook.com/ID/CONNECTION_TYPE For example, my friends  Special ID - me  GET https://graph.facebook.com/me/friends
  9. 9. Graph API Authorization OAuth 2.0  Redirect to Facebook; user authenticates (if necessary) and gives permission for app to access the Graph API  App receives access token representing the user’s permission to access their social graph  App sends access token with Graph API calls as a query parameter https://graph.facebook.com/ID?access_token=TOKENVALUE
  10. 10. Graph API Permissions Access to specific types of graph objects is controlled by permissions  user_likes, friends_photos, publish_stream etc  Requested via scope parameter in OAuth 2.0 request  Balance app functionality against intrusiveness
  11. 11. Searching GET https://graph.facebook.com/search?q=force.com&type=post
  12. 12. Publishing HTTP POST to a connection URL  Access token is required!  curl -F access_token=... -F message=Hello world! https://graph.facebook.com/me/feed  Response: {"id":"667905711_10151088147280712"}
  13. 13. Graph API Explorer https://developers.facebook.com/tools/explorer
  14. 14. Force.com Toolkit for Facebook http://wiki.developerforce.com/page/Facebook_Toolkit Apex binding for the Facebook Graph API Map<String,String> params = new Map<string,string>{fields => id,name, limit => 10}; FacebookUsers friends = new FacebookUsers(access_token, me/friends, params); for (FacebookUser friend : friends.data) { System.debug(friend.name); }
  15. 15. Force.com Toolkit for Facebook Graph API objects modeled as Apex classes  FacebookUser, FacebookPhoto etc <apex:page controller=“FriendsController”> <apex:pageSectionTable value=“{!friends}” var=“friend”> <apex:column value=“{!friend.name}”> </apex:pageSectionTable> </apex:page> Open source, but unsupported
  16. 16. Social Sign-On from Facebook toCustomer Portal Authentication Provider  Built into Force.com Platform  Performs ‘app’ side of OAuth flow  Maps Facebook user to Customer Portal user via Registration Handler class  Can also map to org users, but not as useful in the Facebook context!
  17. 17. Leveraging the Social Graph How do we get our customer portal to ‘go viral’?  Allow users to invite their friends  Super-easy from JavaScript in a Visualforce page with Facebook Dialogs FB.ui({ method: send, to: 123456789, name: Check out this great site!, description: My Portal has everything you need.’, link: http://myportalurl.force.com/, });
  18. 18. Building a Social App Want to (optionally) publish a link to the user’s wall when they close a case – encourage more friends to come use the portal! Can we show a checkbox to allow the user to publish to their wall at the time they close the case, with no Facebook dialog?
  19. 19. Getting an Access Token – Customer Portal public class MyPageController { private static String authProviderId = // Get custom setting; public String getAccessToken(){ Auth.AuthToken.getAccessToken(authProviderId, facebook); } ... } <apex:page controller=”MyPageController” cache="false" sidebar="false" showHeader="false” title=”My Page”>
  20. 20. One Shortcoming with Authentication Provider scope is fixed to email  email address + ‘basic info’ (friends list etc) Right now, out of the box, Authentication Providers work great for Social Sign-On, but don’t allow very rich social apps Unless…
  21. 21. Widening ScopeWorkaround for fixed scope  Use Facebook JavaScript SDK to request additional permissions // We need some permissions - ask for them FB.login(function(response) { if (!response) { alert(Error getting permission!); } else { location.reload(true); } }, {scope: reqperms});
  22. 22. Wrapping Up The Facebook JavaScript SDK and Dialogs allow simple social actions from Visualforce The Force.com Toolkit for Facebook gives access to the Graph API from Apex Authentication Providers allow Social Sign-On to customer portals
  23. 23. Go out and build something cool!
  24. 24. Pat PattersonPrincipal Developer Evangelist, @metadaddy
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×