Top Banner
Chatter REST API Overview
42

Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Apr 18, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter REST API Overview

Page 2: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

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, 2011. 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.

Page 3: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Agenda

§  Why Chatter is important for developers §  Chatter REST API Use Cases

§  API Walk Through

§  Example Code

§  Q&A and application ideas

Page 4: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

WHY CHATTER API?

Page 5: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Why the Chatter API – for IT

§  Make your applications social –  Better communication between silos and teams vs.

email

–  Build a searchable tribal knowledge base on your intranet

Page 6: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Why Chatter – for independent software vendors

§  Chatter is the news feed for the enterprise

§  Distribute your application virally in the feed.

§  Make your application social

§  Add functionality with minimal work –  Feeds, likes, comments

–  Groups

–  Mobile and desktop

Page 7: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Use Cases - Mobile

§  Build custom mobile applications, e.g. –  Product information apps –  Q&A

–  Note taking and case discussion for medical providers

http://github.com/cseymourSF

Page 8: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Use Cases – Intranet & Sharepoint

§  Add social interaction to document sharing and other external systems.

§  Move internal customer interaction into a group based queue

§  Push notifications of changes/updates into chatter.

http://chatter-intranet.heroku.com

Page 9: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Use Cases – Independent Software Vendors

§  Viral distribution

§  Social interaction §  Notifications

Page 10: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

WALKTHROUGH

Page 11: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Introduction

§  The Chatter API is a REST-ful web service that exposes a corporation’s social data.

§  The Chatter API is hosted by Salesforce and uses OAuth2 for authentication

Page 12: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter API Resources

§  Users –  Includes followers, following

§  Groups –  Includes members

§  Feed –  Includes comments, likes

§  Records –  Includes followers

§  Private Messages

§  Trending Topics

§  Recommendations

Page 13: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter API or SObject REST API?

§  Chatter API provides: –  Localized data

–  All the feed data in 1 request –  Data matching what is shown in the web UI

–  Semantically rich resources

§  SObject REST API provides: –  Data directly from the database –  Arbitrary SOQL queries

§  You can mix and match - use the same OAuth tokens to access both

Page 14: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Authentication with OAuth2

§  Peace of mind for users: –  Authenticate through a standard Salesforce login site

–  Apps don’t need to cache a user’s login credentials –  Users can revoke authorization for an app later on

§  Info on using OAuth2 can be found on DeveloperForce

Page 15: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Authenticating and Authorizing

User Authentication App Authorization

Page 16: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Authorizing a Chatter API request

§  Oauth access token is used in the “Authorization” header of a Chatter API request:

Page 17: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter API URLs

<instance URL> + “/services/data/v23.0” + <relative path> + <query string>

§  For example:

http://na11.salesforce.com/services/data/v23.0/chatter/users/00500C23498934

Page 18: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter API Requests

§  An app can request to access and modify social enterprise data: –  Getting the news feed:

•  GET /chatter/feeds/news/me

–  Removing a feed item: •  DELETE /chatter/feed-items/005Q00593948398

–  Following a record: •  POST /chatter/users/me/following&subjectId=00500C23498934

Page 19: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Chatter API Responses

§  Response can be provided in JSON or XML format §  Response gives a “representation” holding one of:

–  requested data

–  confirmation that an operation has completed

–  errors

Page 20: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Sample JSON Response

§  GET /chatter/users/me: { currentStatus = ”chilling";

email = "[email protected]";

name = "Chris Seymour";

photo = { largePhotoUrl = "https://c.gus.content.soma.force.com/profilephoto/729B00000004FUd/F";

smallPhotoUrl = "https://c.gus.content.soma.force.com/profilephoto/729B00000004FUd/T";

};

title = "Senior Member of Technical Staff";

... }

Page 21: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Users Resource

§  Using /chatter/users/<id> and sub-resources: –  Getting user profile

–  Uploading a new photo –  Following records

–  Getting followers –  Retrieving group memberships

§  The alias “me” can be used in place of <id> to access information about the logged-in user

Page 22: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Getting a User Profile

§  GET https://na1.salesforce.com/services/data/v22.0/chatter/users/005D0000001KfqUIAS

§  Response includes Chatter user profile data

Page 23: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Following a Record

§  POST https://na1.salesforce.com/services/data/v22.0/chatter/users/me/following –  Content-Type: application/x-www-form-urlencoded –  Body or param: subjectId=005D0000001Khtv

§  Response includes a URL that can be DELETEd to remove the subscription

Page 24: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Groups Resource

§  Using /chatter/groups/<id>, and sub-resources: –  Getting group information

–  Getting/adding group members –  Getting/posting group photo

Page 25: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Getting Group Info

§  GET https://na1.salesforce.com/services/data/v22.0/chatter/groups/0F9D00000000Enl

§  Response includes Chatter group description and member count

Page 26: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Adding a Group Member

§  POST https://na1.salesforce.com/services/data/v22.0/chatter/groups/0F9D00000000Enl/members –  Content-Type: application/x-www-form-urlencoded –  Body: userId=005D0000001Khtv

Page 27: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Feeds

§  Feed resources provide the feed item data found in the Chatter web UI

§  Issue a GET for feed items using a URL like:

/chatter/feeds/<feed type>/feed-items §  Feed responses are paged

Page 28: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

News Feed

§  /chatter/feeds/news/me

Page 29: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

User Profile Feed

§  /chatter/feeds/user-profile/<user id>

Page 30: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Record Feed

§  /chatter/feeds/record/<id>

Page 31: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Feed Items

§  Feed item properties include: –  createdDate –  type: text post, user status, link post, file post, or tracked

change

–  actor: user or record that posted the feed item

–  comments: first page of comments –  likes: first page of likes

–  body: unformatted text and formatted message segments

Page 32: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Feed Item Body

§  The feed item “body” holds both formatted and unformatted body text properties: –  text: body as unformatted text –  message segments: body as a list of rich segments:

•  Text

•  Hashtag

•  Link

•  Mention (including user information)

Page 33: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Feed Item Body

Text Mention Text Hashtag Text

Page 34: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Common Feed Operations

§  Post a new feed item to a user profile: POST /chatter/feeds/user-profile/005x77839472/feed-items?text=this%20is%20my%20post%20text

§  Comment on a feed item: POST /chatter/feed-items/005x6659304892/comments?text=some%20exciting%20comment

§  Unlike a feed item: DELETE /chatter/likes/005x884930284

Page 35: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Example Code – iOS and Rails

Page 36: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

iOS

Page 37: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Ruby

Page 38: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

App Building Tips

§  Learn OAuth2 –  which “flow” is suitable for your application context?

–  how much trust are you putting in end-user devices?

§  Use separate remote access apps for production and development

Page 39: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Common Stumbling Points

§  Group feeds are just record feeds: /chatter/feeds/record/<group id>

§  A “user profile” feed is different from a “user record” feed

§  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

Page 40: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

Rate Limiting and Availability

§  Rate limiting: –  each user + remote access app combination gets 200 requests

per hour

§  The Chatter API is on in all organizations that have Chatter –  There is nothing the org needs to purchase, its default on.

§  All user types that support Chatter may use the API –  Portal users are not supported, since they don’t have chatter.

–  Users must have the “api enabled” user profile perm on.

Page 41: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

§ The Chatter API makes your applications social § Easy to integrate with existing applications § Great for mobile too

Key Take Aways

Page 42: Chatter REST API Overview - Amazon S3 · Chatter REST API Overview . ... Use Cases – Intranet & Sharepoint ! Add social interaction to document sharing and other external systems.

How do I begin?

§ The Chatter API is available now in all organizations that have Chatter

See the resource page for documentation, sample apps, tips, and a video of this presentation

https://developer.force.com/chatter-api