Yammer topic IDs don’t match in Network Export data

When you export Yammer Network data, it results in a .zip file with several .csv files that contain data for messages, users, groups, topics, …

Topics are “tags” a user can use, like:

The Issue

When data is exported by Yammer to CSV, this is what you get:

(...)Does anyone have experience with [[tag:21196688]]?(...)

Great, that’s tag 21196688, everybody knows that one, right? No, not really.

But wait, we still have the Topics.csv file, I’m sure it will be in there. Let’s see, it is!

...
"26047513","Nativescript"
...

Now wait, that ID doesn’t match the one in the message!

For some reason, Yammer returns a different ID.

If I click the link, I get the tag about page in Yammer, which has the following URL:

https://www.yammer.com/xxx.onmicrosoft.com/topics/26047513#/Threads/AboutTopic?type=about_topic&feedId=26047513

That also has the ID from the CSV file.

A workaround

This is a dirtier workaround than I’d like to admit, but it works rather well.

There is no API endpoint for topics, well there is, but it doesn’t work. There is the /topics/[:id].json endpoint, but it doesn’t work, and neither does /messages/about_topic/[:id].json.

So we use the search API to search for the tag name. We don’t know the name in the messages.csv (that’s our problem!), but we do have the names in the Topics.csv.

So if we iterate through each and every topic and do a search request, we’ll get some results, right?

Yes! So let’s fabricate a request:

https://www.yammer.com/api/v1/search.json?search=Nativescript

When we launch this API call, we get rich results back:

{
    "count": {
        "messages": 2,
        "groups": 0,
        "topics": 1,
        "uploaded_files": 0,
        "users": 0
    },
    "messages": { (...) },
    "groups": { (...) },
    "topics": { (...) },
    "uploaded_files": { (...) },
    "users": { (...) }
}

Ok, so it must be under topics, right?

Guess again, that would have been too easy! The topic only contains the ID from the Topics.csv, so not usable:

"topics": [
        {
            "type": "topic",
            "id": 26047513,
            "network_id": 2491002,
            "name": "Nativescript",
            "normalized_name": "nativescript",
            "permalink": "nativescript",
            "url": "https://www.yammer.com/api/v1/topics/26047513",
            "web_url": "https://www.yammer.com/mobiusgroup.onmicrosoft.com/topics/26047513",
            "references": [],
            "expert_referents": []
        }
    ]

So we only see ID 26047513 appear, not the ID from the message.

But, wait, let’s check out the messages node:

"messages": {
    "threaded_extended": {},
    "messages": [ (...) ],
    "references": [
        {
            "type": "tag",
            "id": 21196688,
            "network_id": 2491002,
            "name": "nativescript",
            "url": "https://www.yammer.com/api/v1/tags/21196688",
            "web_url": "https://www.yammer.com/mobiusgroup.onmicrosoft.com/topics/26047513"
        },
    ], (...)
}

And look, there we get the “ID” 21196688 that we are looking for! We can also check that this is the same ID as the Topics.csv, as this ID also occurs in the web_url parameter: https://www.yammer.com/mobiusgroup.onmicrosoft.com/topics/26047513

Running through all topics from Topics.csv and looking up their corresponding Messages.csv ID proves to be very useful to be able to convert

(...)Does anyone have experience with [[tag:21196688]]?(...)

to

(...)Does anyone have experience with #nativescript]?(...)

Good luck with your Yammer migration adventures! 🙂

Feel free to contact us for more information.