SalesForce Chatter Integration

Introducing Chatter REST API:

Use Chatter REST API to display Salesforce data, especially in mobile applications. Chatter provide feeds, users, groups, and followers, Chatter REST API provides programmatic access to files, recommendations, topics, notifications, purchasing, and more. Chatter REST API is similar to APIs offered by other companies with feeds, such as Facebook and Twitter, but it also exposes Salesforce features beyond Chatter.

When to Use Chatter REST API:

  • Build a mobile app.
  • Integrate a third-party Web application with Salesforce.
  • Display a feed on an external system.

Chatter REST API Architecture:

  • To use Chatter REST API, understand a few characteristics of its architecture, like Chatter REST API uses OAuth 2.0.
  • Chatter REST API responses are minimally HTML entity-encoded by default.
  • For non-HTML contexts, such as native mobile applications, Chatter REST API clients can request raw (unencoded) output.
  • The JSON format is supported with UTF-8. Date-time information is in ISO8601 format.
  • Responses are in JSON format by default. To specify JSON, use Accept: application/json.)
  • Salesforce IDs in response bodies are always 18 character IDs. In request bodies, you can use either 15 character IDs or 18 character IDs.
  • Chatter REST API requests are subject to rate limiting. Chatter REST API has a different rate limit than other Salesforce APIs. Chatter REST API has a per user, per application, per hour rate limit. When you exceed the rate limit, all Chatter REST API resources return a 503 Service Unavailable error code.
  • For applications using a session ID from, the rate limit is per user, per hour. To take advantage of the per user, per application, per hour limit, use OAuth tokens.

Set Up Authorization: Create a connected app in a Salesforce organization and enable OAuth. The client application uses the connected app to connect to Salesforce. Let’s create a connected application on the first step to make an authentication for requester.

  • Enter a Callback URL. It must be secure: http:// does not work, only https:// works.
  • Go to Setup and create a new connected application, as shown in picture.
  • Enter a connected app name.
  • Enter the contact email, as well as any other required information.
  • Select Enable OAuth Settings.
  • Enter an OAuth scope. Select Access and manage your Chatter feed in addition to any other scope you want your connected app to allow access to and click Save.
  • The Consumer Key is created and displayed, and a Consumer Secret is created (click the link to reveal it).


Connect to Chatter REST API Using OAuth: Use OAuth to connect to Salesforce and get an access token. Pass the access token in requests to Chatter REST API. There are multiple way you can access API but easier way is using curl. Curl Command to generate access token through connected app using command line tool. To make a request to Salesforce:




Step 2: To request a user information, use the returned “id”. Pass the returned access_token as a Bearer token in the Authorization request header and get the details.



Step3: Post a New Comment On Chatter



Salesforce APIs:

Resource HTTP Methods Tasks
/chatter/feed-elements GET, POST Post feed elements and search all feed elements in an organization.
/chatter/feeds/files/me/feed-elements GET Returns all feed elements posted with files by people or groups that the context user follows.
/chatter/feeds/news/me/feed-elements GET All feed elements from all groups the context user either owns or is a member of, as well as all files, records, and users the context user follows. Use this resource to get information about feed elements and to post feed elements.
/chatter/feeds/record/recordId/feed-elements GET Returns the feed elements for all the records the context user is following, or all the feed elements of the specified recordId. Use this resource to search a feed or to get the feed elements for a specific feed, including another user’s feed. To use this resource to get the feed elements for a group, specify the group ID as the recordId.
/chatter/feeds/user-profile/userId/feed-elements GET Returns feed elements created when a user changes records that can be tracked in a feed, feed elements whose parent is the user, and feed elements that mention the user. This feed is different than the news feed, which returns more feed items, including group updates. You can post feed items to the user-profile feed. You can get another user’s user profile feed.
/connect/files/fileId GET, POST, PATCH, DELETE Get information about a specified file, including references to external files. Upload a new version of an existing file, including references to external files. Rename a file, move a file to a different folder, and delete a file.
/connect/files/fileId/content GET Returns the content of the file, including references to external files. The content is streamed as the body of the response.
/connect/files/fileId/file-shares GET, POST Returns information about the objects with which the specified file has been shared. Objects can be users, groups, or records. Can also be used to share the specified file with users.
/connect/files/fileId/file-shares/link GET, PUT, DELETE A description of a file shared as a link. Create, access, and delete a file’s share link.
/connect/files/fileId/previews GET, PATCH Get information about a file’s supported previews and generate a file preview.
/connect/files/fileId/previews/previewFormat GET Get a file preview or a specific page in a preview.
/connect/files/fileId/rendition GET A rendition of the file. A rendition is a binary preview of the file. The format of the binary depends on the format specified in the request.
/connect/files/batch/fileIds GET, DELETE Information about a list of files, specified by file IDs. Get information about a list of files and delete a list of files.
/connect/folders/folderId GET, PATCH, DELETE Get information about the specified folder. Move, rename, and delete a folder. Sync the root folder.
/connect/folders/folderId/items GET, POST Get information about the contents of a folder. Add a file to a folder and create a folder. Sync the root folder.
/chatter/groups/groupId/files GET Returns information about the files posted to the specified group.
/connect/topics/topicId/files GET Returns information about the five files most recently posted to the specified topic.
/connect/files/users/userId GET, POST Upload a file, including references to external files, to the Files home or get information about files a user owns. These files don’t include files shared with a user, files a user follows, or general organization files.
/connect/files/users/me/filter/groups GET Returns information about files posted to groups that the specified user is a member of.
/connect/files/users/me/filter/shared-with-me GET Returns information about files that have been shared with the specified user.

2 thoughts on “SalesForce Chatter Integration

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s