A program to delete old slack messages.
Project description
deslackify
A tool to remove your own slack messages.
deslackify can only delete messages that you sent. The token you provide
authenticates as your own account, so it cannot remove messages authored by
other users.
deslackify supports Python 3.10 through 3.14.
Installation
Install the deslackify command with uv:
uv tool install deslackify
Obtaining credentials
deslackify is meant to be run without the overhead of creating a Slack app. It
authenticates as your own browser session, using two values copied from your
logged-in Slack web client (https://app.slack.com):
- Open your workspace in a browser and open the developer tools.
- Token — in the Console, run:
(d=>d.teams[Object.keys(d.teams)[0]].token)(JSON.parse(localStorage.localConfig_v2))
It begins withxoxc-. This is theTOKENbelow. - Cookie — in Application → Cookies →
https://app.slack.com, copy the value of thedcookie. It begins withxoxd-. This is theCOOKIEbelow. (deslackifyre-encodes it as needed, so it does not matter whether the value is shown URL-encoded or not.)
The token and cookie must come from the same logged-in session.
Alternative: a Slack app token
If you are able to create a Slack app, you can authenticate with a user OAuth
token instead of a browser session. It is more stable — it does not expire when
you sign out — and needs no --cookie:
- Create a new app at https://api.slack.com/apps ("From scratch").
- Under OAuth & Permissions, add the User Token Scopes
search:readandchat:write. - Click Install to Workspace and authorize the app.
- Copy the User OAuth Token (it begins with
xoxp-); use it asTOKENand omit--cookie.
Running
deslackify --token TOKEN --cookie COOKIE USERNAME
Both values can also be supplied via the SLACK_TOKEN and SLACK_COOKIE
environment variables (preferred, so the secrets do not appear in your shell
history or process list):
SLACK_TOKEN=… SLACK_COOKIE=… deslackify USERNAME
Or run it once without installing:
uvx deslackify --token TOKEN --cookie COOKIE USERNAME
Use --dry-run first to preview what would be deleted without deleting
anything.
By default deslackify will remove USERNAME's messages that are more than a
year old. You may also manually specify a before date via:
deslackify --token TOKEN --cookie COOKIE --before YYYY-MM-DD USERNAME
Note: If no results are found, you may need to replace USERNAME with
USERID. You can find the USERID by going to Profile & Account, and then
clicking the three dots, and at the bottom, "Copy member ID".
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deslackify-1.0.0.tar.gz.
File metadata
- Download URL: deslackify-1.0.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a172fda3822c379c048d9b3b80f995e619579d3981cf989ab4ca98f04aecdcf8
|
|
| MD5 |
2cac095d222b204991d9ec0669e3dec2
|
|
| BLAKE2b-256 |
f74e7226b413469bc1f73323451bc38a01466ccd08823f6d4abd01905533b201
|
File details
Details for the file deslackify-1.0.0-py3-none-any.whl.
File metadata
- Download URL: deslackify-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b467fb9ca52f34286bc2ec75b8fd756953260c9ef4542dc9e401ee306584a20a
|
|
| MD5 |
3c82d282b62d3f6ce5642e2a4838ea9a
|
|
| BLAKE2b-256 |
6ea8737c99848296593e039fb93b56f9511d39ea8829413c825f79f3961776a8
|