Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/florianwendelborn/slack-cleaner
Nearly-automatically deletes old Slack Messages
https://github.com/florianwendelborn/slack-cleaner
privacy slack
Last synced: 9 days ago
JSON representation
Nearly-automatically deletes old Slack Messages
- Host: GitHub
- URL: https://github.com/florianwendelborn/slack-cleaner
- Owner: FlorianWendelborn
- License: mit
- Created: 2020-01-02T18:21:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-03T22:49:44.000Z (over 4 years ago)
- Last Synced: 2024-11-09T00:42:30.394Z (2 months ago)
- Topics: privacy, slack
- Language: Shell
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Slack Cleaner
## Installation
Run `setup.sh`
### Installing `virtualenv` on macOS
```bash
brew install python
pip3 install virtualenv
```## Configuration
### List of Names
Provide a list of names in `names.txt`:
1. Go to https://yoursubdomain.slack.com/stats#members
2. Select "All Time" and only select the "Username" in "Edit Columns"
3. Remove All columns besides the username (slack-cleaner expects a newline-separated list of usernames)
4. Remove the CSV header if you didn’t do that in step 3
5. Save as `names.txt` in the repo root### List of Channels
Provide a list of channels in `channels.txt`:
1. Go to https://yoursubdomain.slack.com/stats#channels
2. Select "All Time" and deselect everyhing in "Edit Columns"
3. Remove All Columns besides the channel name (`slack-cleaner` expects a newline-separated list of usernames)
4. Remove the CSV header if you didn’t do that in step 3
5. Save as `channels.txt` in the repo root### Slack Username & Token
You can create/retrieve your `SLACK_TOKEN` in the following ways:
| Name | Description | Link |
| ------: | :-------------------------------------------- | :------------------------------------------------------------------------------------- |
| New Way | Workaround to Allow Creating new Slack Tokens | [See @jackellenberger/emojme](https://github.com/jackellenberger/emojme#slack-for-web) |
| Old way | Won’t allow creating new tokens, only renewal | [See Slack Legacy Tokens](https://api.slack.com/custom-integrations/legacy-tokens) |### Configuring via Config File
The easiest way to configure `slack-cleaner` is to create a `config.sh` file with the following content:
```bash
SLACK_TOKEN="your-slack-token"
SLACK_USERNAME="your_username"
```You can also add `SLACK_CLEANER_DAYS_TO_LEAVE="14"` to the `config.sh` file if you want to keep less or more than the default of the last 14 days.
If you want to clean files, you can also add this:
```bash
SLACK_CLEANER_DELETE_FILES="true"
```### Configuration Options
Configuration options can be provided via the environment or added to `config.sh`.
| Name | Description | Default | Required |
| ----------------------------: | :---------------------------------- | :------ | :------- |
| `SLACK_TOKEN` | Your Slack Legacy Token | — | ✅ |
| `SLACK_USERNAME` | Your Slack Username | — | ✅ |
| `SLACK_CLEANER_DAYS_TO_LEAVE` | Amount of recent days to keep | `14` | ❌ |
| `SLACK_CLEANER_DELETE_FILES` | Should files be deleted? | `false` | ❌ |
| `SLACK_CLEANER_SLEEP_BETWEEN` | Adjust to prevent API Rate Limiting | `5` | ❌ |**`channels.txt`**: Channels to delete messages in
**`names.txt`**: Usernames to delete direct messages with## Running
`./run.sh`
Add `--perform` if you actually want to delete the messages it shows. Deleted messages will be saved in `.log` files in the current folder.
## Credits
This is just a simple wrapper around [slack-cleaner](https://github.com/kfei/slack-cleaner) by [@kfei](https://github.com/kfei) to make it easier to regularly clean slack.