Slack Thread Deletion
Delete Slack threads safely by removing all replies before deleting the parent message, with confirmation and audit logging.
Critical Safety Rules
- Always confirm before deletion - Never delete without explicit user approval
- Show what will be deleted - List all messages in the thread first
- Log every deletion - Append to audit log for accountability
- Delete in correct order - Replies first, parent last
- Handle rate limits - Respect Slack tier limits (50 calls/minute for Tier 1)
Workflow
Step 1: List Thread Messages
Use scripts/list-thread-replies.sh to retrieve and display all messages in the thread:
scripts/list-thread-replies.sh <channel-id> <thread-ts>
This shows:
- Parent message (timestamp, user, text preview)
- All reply messages (timestamp, user, text preview)
- Total count
Step 2: Confirm Deletion
Present the list to the user and ask for explicit confirmation:
Found X messages in thread:
- Parent: @user at HH:MM:SS: "text preview..."
- Reply 1: @user at HH:MM:SS: "text preview..."
- Reply 2: @user at HH:MM:SS: "text preview..."
Delete all X messages? This cannot be undone. (yes/no)
Only proceed if user confirms with "yes" or clear affirmative.
Step 3: Delete Thread
Use scripts/delete-thread.sh to delete the thread:
scripts/delete-thread.sh <channel-id> <thread-ts>
The script:
- Deletes all replies first (in chronological order)
- Deletes parent message last
- Respects rate limits (1.2s delay between deletions)
- Logs each deletion to
~/.slack-deletion-audit.log - Reports success/failure for each message
Rate Limiting
Slack API rate limits vary by tier:
- Tier 1: ~1 request per second sustained
- Tier 2: Higher limits for larger workspaces
The delete script uses 1.2 second delays to stay well within Tier 1 limits.
Audit Log
All deletions are logged to ~/.slack-deletion-audit.log:
2026-01-15T20:45:00Z | DELETED | C12345 | 1234567890.123456 | @username | "message text preview"
Format: timestamp | action | channel | message_ts | user | text_preview
Error Handling
The scripts handle common errors:
- Invalid channel or thread timestamp
- Messages already deleted
- Permission denied
- Rate limit exceeded (unlikely with delays)
- Network failures
Errors are reported clearly and logged to the audit file.
Finding Thread Timestamps
Thread timestamp (thread_ts) is the timestamp of the parent message. Get it from:
- Slack UI: Right-click message → Copy link → extract timestamp from URL
- Message tool: Use
messagetool to search/list messages - API: Use
conversations.historyorconversations.replies
Channel ID format: C followed by alphanumeric characters (e.g., C12345ABCDE).
