top of page

Integrating Microsoft Yammer and Salesforce

In today's business environments, both customers and employees are social. Bringing social media into the workplace increases collaboration and connection with peers — anytime, anywhere. Salesforce and Microsoft provide this functionality in the form of Chatter and Yammer, respectively. Both products tout themselves as enterprise-leading social platforms, but in my opinion, the features of Salesforce Chatter outweigh the features of Yammer.

About Yammer and Chatter

Yammer was purchased by Microsoft in 2012. The main business value of Yammer is to bring all your work into one place, so you can share conversations, collaborate on documents, and work more efficiently. Chatter was introduced by Salesforce in 2010. Chatter connects every employee with the files, data, and experts they need and offers enhanced security and sharing features.

The integration

In this blog we will see Salesforce integrating with Microsoft Yammer in both directions.

  • Showing Yammer message on a Salesforce VisualForce page.

  • Posting a Yammer message from Salesforce.

  1. Showing Yammer messages on Salesforce VF page

Below are the simple steps to get it done:

  1. Go to

  2. Sign up or log in with Yammer

  3. Join any of the relevant groups while signing in

  4. On your homepage, click any of the groups from the table on the left.

  5. You will find an “embed this feed into your site” link on the righthand column of page.

  6. This will pop up JavaScript code. Just copy and paste it into your VF page.

  7. You will now be able to see the Yammer messages in Salesforce!


  1. Posting a Yammer message from Salesforce (user activity by API call)

Please follow the below steps to achieve it.

  1. Go to and register a new app. Fill in all the required information and Redirect URL. The Redirect URL should be the landing URL where you want the system to land after authenticating with Yammer. That will provide you client ID and client secret.

  2. Get Auth Token: A “Sign in with Yammer” button on your app’s login page will initiate user authentication. When the user clicks the button it redirects them to Yammer’s OAuth dialog at:[:client_id]&redirect_uri=[:redirect_ur]. Then it will return back to your Redirect URL with the following parameters: http://[:redirect_uri]?code=[:code]

  3. Submit a GET request on the OAuth Token Endpoint, passing in the authorization code you received above, plus your app secret. The endpoint is:[:client_id]&client_secret=[:client_secret]&code=[:code]

Yammer will return an access token object as part of the response, which includes user profile information. From this object, parse out and store the “token” property. This token will be used to make subsequent API calls to Yammer and will not expire.

Once your app has been successfully authenticated, it can write data into Yammer or read data from Yammer. Most commonly, your app will post users activity to Yammer as Open Graph objects.

Example JSON for sending request:

{ "activity":{ "actor":{"name":"Sidd Singh", "email":""}, "action":"create", "object": { "url":"", "title":"Lunch Meeting" }, "message":"Hey, let’s get sushi!", "users":[ {"name":"Adarsh Pandit", "email":""} ] } }

Description of above JSON : <Actor> <Action> <Object> on <App Name>: <Message> For example, “Sidd Singh created ‘Lunch Meeting’ on ‘Hey, let’s get sushi!’”

<Actor> is the Yammer user who created the activity. The actor is linked to the user’s Yammer profile when the activity is displayed in Yammer.

<Action> is a verb that describes the activity. We currently support: Create, Update, Delete, Follow, and Like by default. Additionally, you can create custom verbs.

<Object> is the Open Graph (OG) object on which the action was taken. An OG object represents an entity instance in your application. For example, an event (e.g., lunch meeting) in OG objects are uniquely identified with their URL. Their title is displayed in Yammer as a link to the URL. We recommend sending Yammer as many properties for your OG objects as you can for appropriate display.

<App Name> is the name of your app (specified when registering your app).

<Message> is a free text field to provide context to the activity.

<Users> is an optional field, which allows you to specify recipients of the activity. By default, the actor and their followers on Yammer receive the activity. See more details at under “Delivering to Users.”

  1. Once we define the Activity JSON, then it’s time to post that to the Yammer server.

  2. Make an HTTP request from code (whatever you are using; Apex in our case) and then send to

  3. Make sure to set the content-type of the request body to “application/json.”

Oauth access token sent as a “Bearer” token in the “Authorization” request header:

GET /api/v1/messages/following.json HTTP/1.1 Host: Authorization: Bearer abcDefGhi

(Remember we got the Auth Token in step 4.)

One important note:

This information is posted to Yammer on behalf of the user for whom we have an authentication code. If we need to do it by multiple users, then we have to register the Yammer app for every user in the organization and get the authentication code for each one. We can always store that code to any field on the user record and use that in Apex.

29 views0 comments

Recent Posts

See All


bottom of page