Yammer group and member export via Yammer API to JSON, then converted to CSV

Updated.

Update: awesome pro-tip

Big shout out to Scott Hoag (@ciphertxt on Twitter) with this pro-tip which will save you having to read this blog post. Yes, you don’t know what you don’t know.

Part of a Yammer network merge (which I am writing a blog post about.. WIP), you would lose data, posts, files etc as that can’t come across. You can however do an export of all that data to, depending on how much there is to export, usually a large .zip file. This is where Scott showed me the light. In that export, there are also two .csv files that contain all the user info in the first, and in the second all the group info. Knowing this, run that export process and you probably don’t need to read the rest of this blog post. #FacePalm.

HOWEVER, and that is a big however for a reason. The network export process does not export what members there are in groups in that groups.csv file. So if you want to to export Yammer groups and all their members, the below blog post is one way of doing that process, just a longer way…


Yammer network merges are not pretty. I’m not taking a stab at you (Yammer developers and Microsoft Office 365 developers), but, I’m taking a stab.

There should be an option to allow at least group and group member data to be brought across when there is a network merge. Fair enough not bringing any data across [1.See under Before you begin, Microsoft Office 365 Support, article source here] as that can certainly be a headache with the vast amount of posts, photos, files and various content that consumes a Yammer network.

However, it would be considerably much less painful for customers if at least the groups and all their members could be merged. It would also make my life a little easier not having to do it.

Let me set the stage her and paint you a word picture. I’m no developer. Putting that out there from the start. I am good at problem solving though and I’m a black belt at finding information online (surfing the interwebs). So, after some deliberation, I found the following that might help with gathering group and user data, to be used for Yammer network merges.

Lets begin

I’m going to go through this pretty rapid fire as there’s not too much to it and overall the shouldn’t be too tricky to follow.

To get this to work and to ensure the process doesn’t freak out because of existing cookies etc, launch your favourite web browser in incognito or private browsing mode. I use Google Chrome and thats the basis of this blog post. I assume and hope the same experience carries across to other browsers.

From there, login to your Yammer network, easy.

At the bottom left of the Yammer main screen, you’ll find: Discover More Groups. Select that.

You’ll be presented with all your available groups in your network.

Pro-tip: unless you have private content enabled[2.Private content, Microsoft Office 365 Support, source article], you won’t see all the groups.

Go to Settings > Network Admin > Content Mode > change from Default to Private Content Mode to access to groups, even those that are private / hidden.

When you select any group and are taken to that group, you’ll be able to see a pattern in the URL; something alone lines of the following:

https://www.yammer.com/customer.com/#/threads/inGroup?type=in_group&feedId=1234567

That last part of the URL, after the “&feedId=”, the number XXXXXXX, contains the group ID which we can then use with the Yammer API to export the group and all its member data into JSON. NICE!

I found the required process after doing a Google search and coming across an article on[3.Hypnotic Ocelot, answer, on StackOverflow article here] StackOverflow. However, this is limited to the first 50 results per page. So I was a little stumped. I needed to export a group with 150 members. I then went around again, but, found the Yammer API developer site[4.Yammer Developer Centre documentation] and after some digging through the REST API options, I found the solution!

Open a new TAB in the same incognito browser session and enter in the below URL, while appending your unique group ID:

https://www.yammer.com/api/v1/users/in\_group/{groupID}.json

Grab a group ID from one of your network groups and the URL should look something like the following and hit enter:

https://www.yammer.com/api/v1/users/in\_group/1234567.json

Your TAB will refresh and you’ll be presented with a JSON file that contains member info for that group. Happy days! Almost. The page will only show the first 50 results [5.Developer support, Yammer, article reference re /users/in_group…]. To overcome that, we can then use a parameter at the end of the URL to specify which page we want to see.

Enter in the parameter of …?page=X with X representing the page numbers you would have access to at the end of your URL. Below shows what that would look like:

https://www.yammer.com/api/v1/users/in\_group/1234567.json?page=2

If you has say 150 members in your group, you would be able to access pages from 1 to 3. Once you reach the limit of accessible data for that group, you’ll get something like:

{"users":[],"more_available":false,"meta":{"followed_user_ids":[]}}

Now, if you’re a JSON guru, from here you can take it away and use the data as you need. However, when working with PowerShell or even accessing the data in a much more accessible way, I prefer to use CSV files. This is where I use a handy website to convert the JSON to CSV format. The URL for the site is: https://konklone.io/json/ and its made by Eric Mill (reach Eric on Twitter @konklone).

Copy and paste the JSON into the top section of the conversion site. It will then render (in browser, not server side) in the lower section and offer an option to download the CSV. I’ve tried this while being offline and it worked for me. Bear in mind that I visited the site first and therefore had it cached locally. Why it worked for me.

In summary

I’ve said this before in a blog post, for sure, but you learn something new every day. While I’m not a developer, I understand the interwebs. REST and RESTful methodology has really become the dominant force in all things “cloud”. Taking advantage of REST API’s is as easy as finding what the API is and the optional parameters.

If you have better ways of doing this or ways to streamline the process, please share as I’d love to make my life easier. Work smarter, not harder.

Read more on:
Comments...
Disclaimer
Shout out 👍