Skip to main content

The Wayslack Machine: incrementally archive Slack messages and files using Slack's team export format

Project description

The Wayslack Machine

The Wayslack Machine: incrementally archive Slack messages and files using Slack’s team export format.

Wayslack can also delete old files from Slack, freeing up storage space forusers on the free tier. See the delete_old_files option.

Getting Started

  1. Install wayslack:

    $ pip install wayslack
  2. (optional) Export your team history and unzip it: https://get.slack.help/hc/en-us/articles/201658943-Export-your-team-s-Slack-history

  3. Get a legacy token from: https://api.slack.com/custom-integrations/legacy-tokens

  4. Run wayslack path/to/export/directory to create an archive if one doesn’t already exist, then download all messages and files:

    $ wayslack my-export/
    API token for my-export/ (see https://api.slack.com/custom-integrations/legacy-tokens): xoxp-1234-abcd
    Processing: my-export/
    Downloading https://.../image.jpg
    #general: 10 new messages in #general (saving to my-export/_channel-C049V24HY/2016-12-19.json)
    $ ls my-export/_files/
    ...
    https%3A%2F%2F...%2Fimage.jpg
  5. Optionally, create a configuration file so multiple teams can be archived easily:

    $ cat ~/.wayslack/config.yaml
    ---
    archives:
      - dir: path/to/slack/first-export # path is relative to this file
        # Get token from: https://api.slack.com/custom-integrations/legacy-tokens
        token: xoxp-1234-abcd
        # Delete files from Slack if they're more than 60 days old (useful for
        # free Slack channels which have a file limit).
        # Files will only be deleted from Slack if:
        # - They exist in the archive (_files/storage/...)
        # - wayslack is run with --confirm-delete
        # Otherwise a message will be printed but files will not be deleted.
        delete_old_files: 60 days
      - dir: second-export
        token: xoxp-9876-wxyz
    
    $ wayslack
    Processing: first-export
    ...
    Processing: second-export
    ...

Deleting Old Files from Slack

The delete_old_files option (along with the --confirm-delete flag) can be used to delete old files from Slack, freeing up the team’s storage.

Files will only be deleted if the --confirm-delete flag is used, the files exist in the local archive, and their size matches the size reported in Slack’s API.

Note: due to a bug in Slack’s API, the file size reported by Slack’s API is sometimes incorrect. Because Wayslack will not delete files when the local size does not match the remote size, a few warnings will almost always be generated when deleting files (and, obviously, those files won’t be deleted).

IMMATURITY WARNING

WARNING: wayslack is still somewhat immature and not completely tested. Right now it will archive:

  • Public messages

  • Private groups

  • Private messages

  • All uploaded files

  • All link previews

  • List of channels

  • List of users

  • Files

But it will likely be very slow for larger (100+ user or channel) teams, doesn’t have any configuration options, and likely has bugs which will only be found with time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wayslack-0.2.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

wayslack-0.2.0-py2-none-any.whl (20.7 kB view details)

Uploaded Python 2

File details

Details for the file wayslack-0.2.0.tar.gz.

File metadata

  • Download URL: wayslack-0.2.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wayslack-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f13d69bcc43cd8091475035e2c5484050021a49d8b129b2999cfc54f690ccda
MD5 050cf3760af847a59ccf3816194d1755
BLAKE2b-256 51303fd31e9709a020598e6ecc80ea3f6fe4598de61696df63a60a787b92ff02

See more details on using hashes here.

File details

Details for the file wayslack-0.2.0-py2-none-any.whl.

File metadata

File hashes

Hashes for wayslack-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 168a4f1d4ff601880fdaa68ae66ccbb71344d61b913d963c589b8e048ffb88bc
MD5 ef35122b3a53861233ab2d8e12398ca6
BLAKE2b-256 b23ef853755cc34f18892f557d932805ecf97b7ca0d42c14228e8508cbb0b1cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page