At SharePointkonferenz.at (#spkonfat) we from atwork - Martina and me - had a session about Yammer with the title "Who needs Yammer when we have SharePoint?" (see program). Martina gave an overview of Enterprise Social, differences between SharePoint Social and Yammer, experiences, projects and studies.
When using social tools remember: "Social Enterprise is implemented 80% through organization culture and 20% through technology." by Gartner, September 2012. It´s our recommendation to have key users in each company to promote and help employees to understand what it means to work like a network.
At the end we showed an example how it is possible to get and post data into a Yammer network just to deliver an idea how Yammer can be integrated in other systems and networks and how this can be accomplished.
Post to Yammer from an App
So if your´re interested in the Developer´s HowTo here´s the step by step article. This is part 1 of 2.
The target is to create a very simple Console App which reads information from a Yammer Network and posts some data into that network. The "data" in our sample is a message from a specific user and is hardcoded. In real life this data would come from any other system like SharePoint, ERP systems or similar.
For playing around we created a public group with the witty name "Yammer 101".
Here´s a screenshot of that group in our Yammer Enterprise Network "atwork.at".
You need to have an (verified) administrator to create an app in Yammer. To post through your app on behalf of a Yammer user you need to work with a Yammer Enterprise Network. In the free (non enterprise) Yammer network it´s not possible to impersonate. Also reporting is a feature of the enterprise version of Yammer.
Create a Yammer App
The first step is to create an App in Yammer. These steps are also described in the Yammer Developer Center in https://developer.yammer.com/create-an-application/. We follow that description in our guide here, too.
We need to be logged in as network administrator. Open the menu in the right menu bar "..." and click "Created Apps". Alternatively you can open the link https://www.yammer.com/client_applications.
This page shows all registered applications for that admin.
Click "register New App" on the left side. Now fill out the App dialog like in this screenshot with your Yammer app name and your organization details.
When hitting Continue you immediately get the app data with Client ID and Client secret. Because we also need a Yammer "code" we need to enter a Redirect URL. So click "Basic Info" on the left side to complete the app data.
Don´t forget to Save the settings, you find the button at the end of the page. Now we have all (basic) necessary settings for our app: Client ID, Client secret and Redirect URL.
Done. See some help about all settings at http://developer.yammer.com/introduction/#gs-registerapp.
How the authentication works
Now we need to accomplish some additional steps to get a valid token for our own app. The following slide (taken from SPC2014 in a little modified version) shows the process how to obtain this data.
No we need to implement an authentication mechanism for our app to connect to Yammer. The authentication uses an OAuth 2 flow.
- First there´s the user authenticating with the user´s Yammer credentials.
- Next, the user authorizes your app to connect to their Yammer network.
- The end result is a token your app will use to write events to Yammer and retrieve Yammer data.
So let´s create the first URL with that pattern:
...and replace the placeholders with our own client settings:
When opening this URL we get a dialog asking for permission for YamDemo2014:
Of course we "Allow" the app the to access data.
Yammer uses our Redirect URL now and directs to the address and adds a parameter with ?code=.... In my case there´s no app running on my localhost and the browser delivers an HTTP 404 (not found), but that´s not important now (and you can use any valid URL instead of localhost too).
In our sample the URL with the code is
Now we use our Client data and that code in the next URL pattern:
So here we go:
Let´s open that URL. As result Yammer sends a file access_token.json. Save it to disk or open it.
In the JSON-file we get all information for the logged in user. For working in our app we need the generated "token"-value, in our sample it´s "3vT2...".
Tip: Since the token is the same for this user in all networks I changed the real values. The credentials posted here are not valid, just to show how it looks. Please note that the "expires_at" value is "null". So the token you get is valid forever (which is good in our case for our app). Let´s see if Yammer/Microsoft will change this in future time...
With that token value we can (later) work with our app.
If you want to remove an App open https://www.yammer.com/[tenant]/account/applications.
When clicking Revoke Access the app is removed instantly.
That´s the app creation and manipulation process.
See part two how to develop a simple .NET solution where we access the Yammer Network programmatically.