Skip to content

elonen/slack-archive

 
 

Repository files navigation

slack-archive-logo

Export your Slack workspace as static HTML

Alright, so you want to export all your messages on Slack. You want them in a format that you can still enjoy in 20 years. This tool will help you do that.

  • Completely static: The generated files are pure HTML and will still work in 50 years.
  • Everything you care about: This tool downloads messages, files, and avatars.
  • Nothing you do not care about: Choose exactly which channels and DMs to download.
  • All types of conversations: We'll fetch public channels, private channels, DMs, and multi-person DMs.
  • Incremental backups: If you already have local data, we'll extend it - no need to download existing stuff again.
  • JSON included: All data is also stored as JSON, so you can consume it with other tools later.
  • No cloud, free: Do all of this for free, without giving anyone your information.

Screen Shot 2021-09-09 at 6 43 55 PM

Using it

  1. Make sure you have Node.js installed, ideally something newer than Node v14.

  2. Download and run a temporary installation of the package, through the mighty npx1 runner:

    npx slack-archive
  3. Feed your User OAuth Token to the prompt and let the program interactively guide you through all the options.

  4. The exported data will be stored, in nice HTML format, inside the ./slack-archive subdirectory. If the subdirectory already exist the program will compare the available workspace data with its content and download and merge only the newer additions.

Alternatively, to run a development version in Docker:

  1. Checkout the code from Git
  2. Make sure Docker is installed
  3. Run ./run_in_docker.sh

This will build Docker image called slack-archive:dev, compile it and start the interactive guide. Results wil be saved in folder slack-archive_USERDATA/.

Parameters

Getting a token

In order to download messages from private channels and direct messages, we will need a "User OAuth Token" associated with you and the target workspace. Slack uses this token to identify what permissions it'll give this app. We used to be able to just copy a token out of your Slack app, but now we'll need to create a custom app, install it to the target workspace and retrieve the token from its Slack API tab.

This will be mostly painless, I promise.

1) Configure your custom app

  • Head over to https://api.slack.com/apps and sign in to your account.
  • Press the Create New App button and select the From an app manifest option.
  • Choose the workspace you'd like to backup with slack-archive.
  • When prompted for an App Manifest, just paste in the following yaml configuration:
_metadata:
  major_version: 1
  minor_version: 1
display_information:
  name: "Slack-Archive_<username>"
  description: "Export user-visible channel data as static HTML. Incrementally."
  background_color: "#de0446"
features:
  bot_user:
    display_name: Slack-Archive
    always_online: false
oauth_config:
  scopes:
    user:
      - channels:read
      - channels:history
      - files:read
      - groups:read
      - groups:history
      - mpim:read
      - mpim:history
      - im:read
      - im:history
      - users:read
    bot:
      - commands
      - chat:write
      - chat:write.public
settings:
  org_deploy_enabled: false
  socket_mode_enabled: false
  token_rotation_enabled: false
  • Replace <username> with whatever identifier you prefer (e.g. your-surname); please notice that this app-name will be visible to all the workspace members, in the Apps tab of the Slack UI.
  • Proceed and confirm the summary: your custom app is ready!

2) Authorize

  • Select Install to Workspace at the top of the app page (or Reinstall to Workspace if you have done this previously).
  • You will be prompted to an authorization page, review the permissions (they should match what you have configured in the yaml manifest).
  • Then, from the Features menu on the left of the app page, select OAuth & Permissions: there you will find your User OAuth Token, which will generally be in xoxp-********... format. This is the token you need to past into the slack-archive prompt, in order for the program to work.

Footnotes

  1. NPX is an acronym for Node Package Execute. It comes with NPM, the Node Package Manager. NPX has the ability to execute a Node package which wasn't previously installed, downloading it on the flight from the NPM registry.

About

Generate static HTML archives of Slack workspaces

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 78.6%
  • HTML 12.3%
  • CSS 8.0%
  • Other 1.1%