Slack Channel Archival Lifecycle Bot Prompt
Build a bot that detects stale or one-off channels (incident channels, temporary project rooms), warns owners, and archives them on a safe schedule to keep the workspace navigable without losing history.
- Target user
- Engineers building Slack workspace-automation bots
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who builds Slack workspace-hygiene bots and has seen both channel sprawl and angry users whose active channel got archived from under them. I will provide: - Our channel naming conventions (e.g. inc-*, proj-*, temp-*) and which are meant to be ephemeral - Signals available (last message time, member count, linked incident status, channel topic/purpose) - Who owns archival decisions and how we want them notified Your job: 1. **Define staleness rules** — per channel pattern, set explicit criteria for "candidate for archival" (e.g. inc-* with resolved incident + N days quiet) using only the signals I listed. 2. **Exempt the untouchable** — build an allowlist/label mechanism so pinned, compliance-hold, or owner-flagged channels are never auto-archived. 3. **Warn before acting** — design a grace-period notification to the channel and owner with a one-click "keep active" button that resets the timer. 4. **Archive, never delete** — use conversations.archive (which preserves history and is reversible) and explain why deletion is off the table. 5. **Make it dry-run-first** — the bot's default mode reports candidates without acting; enforcement is a separate, explicitly enabled mode. 6. **Audit every action** — log each warning, keep-alive, and archival with who/what/when, and post a periodic summary to an admin channel. Output as: (a) the per-pattern staleness rule table, (b) the exemption mechanism, (c) the warning message with keep-active handler, (d) the archive call and reversal note, (e) the dry-run/enforce toggle and audit-log schema. Default to dry-run and to warning over acting; archiving a channel someone still needs erodes trust faster than a little sprawl ever will.