Export and Backup Your Data and Files from Slack

Andreas Katzian
The Jade Mind
Published in
3 min readJul 5, 2022
Photo by Pankaj Patel on Unsplash

We decided to opt-out of the very noisy universe of Slack in favor of native frictionless messaging, note-taking, and sharing tools. So after navigating the Slack Data Export Jungle and finally exporting data as JSON files, we created a handy Python script to download and backup all shared files, so you don’t have to.

Slack was a good companion over the years, but focusing on actual work while subscribed to multiple Slack workspaces was getting difficult.

In addition, the overabundance of messages during the day was no longer acceptable. To get back on focused work and calm down, we set a fixed deadline for closing our Slack workspace and signing out of all customer workspaces. We used Slack for several years and shared a lot of information, knowledge, and files. So naturally, we did not want to lose any of that.

The Slack export feature enables you to export your data depending on your active subscription.

Free and Pro plan:
The zip file will contain your workspace’s message history in JSON format and file links from all public channels.

Business plan:
The zip file will contain your message history in JSON format and file links from all public channels or from all channels and DMs, depending on your export type.

Enterprise plan:
The zip file will contain your organization’s message history in JSON format and file links from all channels and conversations.

You must be on the Business Plan to export all private channels and conversations. We used a Pro plan for our company over the years, so we had to switch to the Business Plan to create a full export of the whole workspace with all vital information. So, we deactivated all unused user accounts and upgraded to a Business plan, allowing us to export all channels and direct messages as JSON files.

After downloading the workspace export, we got all our channels and direct messages as separate folders, including a JSON file for each day a conversation did take place. Each JSON file consists of an array of messages containing all necessary information. In addition, the files array within the message dictionary includes all shared files during the conversations.

The property url_private contains the secret URL to the file you need to download. After closing the Slack account, Slack will remove all your files from its servers. Therefore, you need to download and store them in a secure location to retain a full backup.

Fortunately, we crafted a simple Python script to do the job automatically. It goes through all channel directories, creates a “files” folder, and stores the downloaded files. Moreover, the file names are kept the same but prefixed with the message’s ID to avoid collisions.

If you are interested in the downloader script, check out our public repo or just copy the Gist below. It requires a Python 3 environment, and you must pass the path to your Slack export folder. A progress bar displays the status of the download. The execution of the script is idempotent, meaning you can execute it multiple times, and it will download only missing files. This behavior enables you also to backup your files regularly.

Originally published at https://jademind.com.

--

--

Andreas Katzian
The Jade Mind

Passionate software developer and problem solver in topics like platform development, mobile, data integration and digital transformation.