Making Your Application Social with the Chatter API
@quintonwall
/add_address
@add_address
in/add_address
Agenda
§ Why Social Enable Your App? § Use Cases
§ REST API Resources
§ Tips
§ Summer ‘12 Preview
§ Q&A
Make any app social with the Chatter API
REST API
IT: Why Social Enable Your Custom Apps?
Collab between dept. & teams
Make existing apps social
Partners, customers, suppliers
ISV: Why Social Enable Your Apps?
Connect to enterprise-wide news feed (eg:
Chatter)
Distribute app virally via feed
Easily add social functionality (feeds, likes, comments etc)
Chatter API Use Cases
/add_address
@add_address
in/add_address
Next Generation Intranets for the Social Enterprise
§ Company-wide and team based collaboration
§ Dynamic, real-time information
§ Integration of multiple data sources
§ Sharepoint webpart reference implementation
Burberry World
Use Case – Custom Mobile, Desktop, Tablet Apps
§ Build custom mobile applications, e.g. – Product information apps – Q&A
– Note taking and case discussion for medical providers
https://github.com/quintonwall/rhatter
https://github.com/cseymourSF/Chatter-API-iOS-Sample
Use Case - Internet of Things • Share service data
from Cars, Generators, Computers – using custom object records / feeds
• Foster conversation
centered on products and services.
• Scenarios: - Service - Technical presales - Technical support - Project
Management
Build Highly Branded Customer Communities
• Enable partners or customers to collaborate with your employees or each other
• Share business process data
• Customize the UX to meet your exact brand requirements
• Extend to mobile and tablet apps
Drive Collaboration Around Business Process and Data
• Chatter feed inside external applications
• Supplement data, process, and analytics with rich conversations
• Analytics, Finance, Supply Chain Management, HR
REST API Resources
/add_address
@add_address
in/add_address
Apigee is your friend.
Chatter API Resources
Specify version (v24 is the lasted)
All requests require OAuth token
/chatter/users/me
Feed Item Resources
Chatter/feeds/news/{userId}/feed-items!
Comments Resources
Chatter/feed-items/{feedItemId}/comments!
Adding a feedItem Chatter/feeds/user-profile/{userId}feed-items!
Working with Chatter Profile Photos
Chatter API Tips
/add_address
@add_address
in/add_address
Chatter API or SObject REST API?
§ Chatter API: – Semantically rich resources
– Localized presentation-ready data in JSON or XML form – Comprehensive feed data in a single request
– Matches the web UI
§ SObject REST API: – Data directly from the database – Arbitrary SOQL queries
§ The same Oauth tokens can be used for both
Tips - General
§ Group feeds are just record feeds – /chatter/feeds/record/<group id>
§ Security model of UI is observed – News feed can only be retrieved for the logged-in user
§ Following an object is described by a “subscription”. DELETE the subscription to stop following
§ Use 'Accept-Encoding: gzip, deflate’ HTTP header
§ Always encrypt your Oauth access and refresh tokens
Rate Limiting
§ Rate limiting: – each user + remote access app combination gets 200 requests
per hour
§ Requests to endpoints outside /chatter and /connect are not counted in this rate limit – Image requests not rate limited
– Sobject API requests count against org-wide rate limit
§ Use separate remote access apps for production and development to avoid being rate limited – Also use different users if your automated tests run often
Tips – Javascript served from non-salesforce domain
§ Use a controller pass-thru to work around Single Origin Policy for ajax requests
§ Two approaches to rendering: – pass JSON responses through server as-is and render using
client side template library such as Mustache, Handlebars, or Eco
– Deserialize and render to HTML on the server and send to client
§ Requests from HTML (img tags, HTML forms) must also use controller pass-thru to put Oauth token into HTTP header
Tips – Javascript served from salesforce domain
§ Can make ajax requests directly to Chatter API and render to HTML on client. – When Connect in Apex goes GA, you can also make requests
to a controller to get custom rendered HTML.
§ Use an ajax proxy if you’re on a custom domain. (see the salesforce ajax toolkit) to work around SOP.
Tips – Apex
§ Apex Now – Call the Chatter API using Apex callouts
– Use session Id from UserInfo
§ Apex Future – ConnectAPI class will provide Chatter API resources directly
Connect in Apex
/add_address
@add_address
in/add_address
Connect in Apex (Pilot in Summer)
§ Exposing the same Chatter API resources and data in Apex
§ Use cases include: – Customized social experiences in Visualforce
– Custom Chatter feed rendering in Visualforce – Posting feed items with @-mentions in Apex
– Modifying user and group photos in Apex
Connect in Apex Demo
Take Aways
§ Chatter can drive better user engagement with external applications
§ Easy to build integrations with existing applications
§ Wealth of interesting use cases emerge from news feed integration.
How do I begin?
https://developer.force.com/chatter-api
Thank You.
Top Related