My chat community on Slack for digital nomads, called #nomads, has almost 4,000 members now. And it’s been going for almost a year now (actually, exactly 6 days and it will be one year, wow!).
Since it’s 4,000 people, we’ve always had issues with the 10,000 message limit for free Slack accounts. It’d cost about 4,000 * $15/m or $720,000/y to pay for, which I can’t afford. So we’ve just accepted it as being there. It’d be fun to read the archive sometimes though.
But then @reustle messaged me today:
So Slack actually had an export function, which free users can use too. Awesome! Slack had this for ages, I just never saw it myself.
You can access it at https://slack.com/archives and then click Export Data. It might take a while.
Slackbot will send you a message when it’s ready with a download link:
The problem is that this export is a .ZIP file full of JSON files.
Everything IS in fact in there, but it’s pretty hard to read.
Also all usernames are replaced by user ids, and there’s no user images to be found in the chat logs. They’re in a different file called users.json. All channel names are also replaced by channel ids, which can be found in channels.json.
Point is, it’s a big maze of files and data.
So I wrote a script that ties everything together and outputs nice Slack-looking HTML files of your entire JSON export. Automatically!
It makes this:
Look like this:
The script does a few things:
– Load the users file to identify user ids (and add user pics)
– Load the channels file to identify channel ids
– Compile daily logs into single channel logs (in JSON)
– Generate a layout from channel logs (in HTML)
– Generate an index.html with links to all channel logs in your Slack
Here’s how it looks when you run it:
And here’s how the output looks in a browser:
It’s up here on GitHub, the code is REALLY rough but it works pretty well: https://gist.github.com/levelsio/122907e95956602e5c09.
You’ll need to run it from your shell in the folder of your extracted (!) Slack export ZIP file. It will then make a folder called slack2html above the folder your in with all JSON and HTML files.
Hope this helps!
As mentioned, a search interface would be cool to make too, so if anyone would like to fork my Gist script and add that in the HTML, go for it!
P.S. I'm on Twitter too if you'd like to follow more of my stories. And I wrote a book called MAKE about building startups without funding. See a list of my stories or contact me. To get an alert when I write a new blog post, you can subscribe below: