Exporting messages from your personal Slack.

Exporting messages from your personal Slack.

Slack used to be pretty useful for trading links with your friends. Unless you had more than 10,000 messages, it was fine. But at some point, the free plan got bumped down to 90 days only, and that was a pretty rotten move for low-volume personal chat rooms.

Slack has had a way to export data to a ZIP file containing messages, and it works exactly as described. The files inside the ZIP file are arranged by subdirectory and date. Here's a sample of what was in my export file.

$ slack-export-viewer git:(master) unzip -v '/home/tim/Dropbox/./GOOGLE_DRIVE/Tim/slack/LinuxTampa Slack export May 19 2019 - Oct 20 2023.zip'
Archive:  /home/tim/Dropbox/./GOOGLE_DRIVE/Tim/slack/LinuxTampa Slack export May 19 2019 - Oct 20 2023.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 2023-10-20 16:33 00000000  funny/
    7443  Defl:N     1677  78% 2023-10-20 16:33 539e36fe  funny/2022-06-28.json
    3043  Defl:N      755  75% 2023-10-20 16:33 a7687500  funny/2022-10-26.json
    1499  Defl:N      534  64% 2023-10-20 16:33 2d477609  aws-announcements/2023-05-15.json
    3171  Defl:N      701  78% 2023-10-20 16:33 a9a37985  aws-announcements/2019-06-20.json
    2106  Defl:N      632  70% 2023-10-20 16:33 a4c17ead  mac-tips/2019-09-09.json
    3927  Defl:N     1092  72% 2023-10-20 16:33 928798db  career-advice/2022-07-25.json
   10035  Defl:N     3575  64% 2023-10-20 16:33 fe2c672b  career-advice/2022-01-28.json
...
$

But after you extract the file and explore the JSON files, you realize this isn't the most readable thing in the world:

[
    {
        "type": "message",
        "subtype": "channel_join",
        "ts": "1569464732.000200",
        "user": "UJVMHTQ0P",
        "text": "<@UJVMHTQ0P> has joined the channel"
    },
    {
        "client_msg_id": "3c9dce9b-62ea-4b66-ae0c-2af4eb2bf8cd",
        "type": "message",
        "text": "<https:\/\/github.com\/lukesampson\/scoop> - brew-like package manager for windoze",
        "user": "UJVMHTQ0P",
        "ts": "1569464741.000500",
        "blocks": [
            {
                "type": "rich_text",
                "block_id": "1Jg22",
                "elements": [
                    {
                        "type": "rich_text_section",
                        "elements": [
                            {
                                "type": "link",
                                "url": "https:\/\/github.com\/lukesampson\/scoop"
                            },
                            {
                                "type": "text",
                                "text": " - brew-like package manager for windoze"
                            }
                        ]
                    }
                ]
            }
        ],
        "team": "TJTSLFV96",
        "user_team": "TJTSLFV96",
        "source_team": "TJTSLFV96",
        "user_profile": {
            "avatar_hash": "g31217e9626b",
            "image_72": "https:\/\/secure.gravatar.com\/avatar\/e931217e9626bfe1e978c24c5984e40a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0020-72.png",
            "first_name": "Tim",
            "real_name": "Tim Bailey-Jones",
            "display_name": "",
            "team": "TJTSLFV96",
            "name": "tim",
            "is_restricted": false,
            "is_ultra_restricted": false
        }
    }
...
]

Enter slack-export-viewer on github.com. It provides a webserver listening on port 5000 that provides a reasonable approximation of the real Slack Web user interface.

And here's the results. Perfectly browsable message history. I'm going to mine it for blog post ideas.

MISSION ACCOMPLISHED!

I had to issue a small PR pinning the Werkzeug and Flask libraries to the latest 2.x versions, because those libraries' 3.x have breaking changes. The maintainer merged it quickly, and now it works out of the box again!