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".
Release files for deslackify 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deslackify-1.0.0.tar.gz | 28.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deslackify-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.3 kB
Release files / deslackify-1.0.0.tar.gz
| Download URL | deslackify-1.0.0.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a172fda3822c379c048d9b3b80f995e619579d3981cf989ab4ca98f04aecdcf8
|
|
BLAKE2b-256 checksum How to use checksums |
f74e7226b413469bc1f73323451bc38a01466ccd08823f6d4abd01905533b201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / deslackify-1.0.0-py3-none-any.whl
| Download URL | deslackify-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b467fb9ca52f34286bc2ec75b8fd756953260c9ef4542dc9e401ee306584a20a
|
|
BLAKE2b-256 checksum How to use checksums |
6ea8737c99848296593e039fb93b56f9511d39ea8829413c825f79f3961776a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|