This script detects old Slack channels and groups which have not been used in a while and outputs their names to the console. It also sends a configurable warning message to these channels indicating that they have been deemed "old".
- Create a new Slack app for the team at https://api.slack.com/
- Authorize it with
incoming-webhook,channels:read,groups:read&chat:write:botpermissions. - Install the app manually using the button in the UI and copy the auth token to
.env, using the formatSLACK_TOKEN=${AUTH_TOKEN_STR}.
You can fiddle with STALE_TIME_DIFF and STALE_CHANNEL_MESSAGE in the code to configure the particulars of the channel detection and warning message posting.