CLI tools to bulk delete messages from Slack.
- (Install Poetry if needed).
- Clone this repository.
- Run
poetry install
.
git clone https://github.com/tdiam/slack-deleter
cd slack-deleter
poetry install
In order to use this tool in your Slack workspace, you need to create an "app".
- Create app.
- From the "Add features and functionality" panel click on "Permissions".
- Click on "Add an OAuth Scope" under "User Token Scopes".
- Add the
channels:history
andchat:write
permissions. - Click on "Install App to Workspace".
- Hooray, you now have your "OAuth Access Token" (the one starting with
xoxp
)!
Copy the env.sample
file to .env
and replace the SLACK_TOKEN
value with the OAuth Access Token you obtained.
poetry shell
slack-delete <command> [<args>]
# As printed by `slack-delete --help`
usage: slack-delete <command> [<args>]
Available commands:
batch Delete messages from a list of timestamp IDs.
between Delete messages between timestamps.
For detailed command syntax, run slack-delete <command> --help
.
slack-delete batch CUCF5C996 p1600870610000500 p1600920629000110 p1599182440024000 p1598788187006000 p1599679370045000
slack-delete between CUCF5C996 --from_ts 1600870610.000000 --until_ts 1600920629.000000
slack-delete between CUCF5C996 --from_ts $(date --date='yesterday' +%s.000000)