πŸ”§ Bulk delete Slack messages with smart filtering and confirmations

⚑ 106 views Β· πŸ”§ Miscellaneous

Description

🧹 Jedi Cleaner for Slack

❌ Slack’s Limitation

Slack lacks a native bulk delete feature. Users must delete messages manually, which is time-consuming and inefficient for large volumes.

βœ… Our Solution

Jedi Cleaner automates Slack message deletion using smart filters, safety confirmations, and enterprise-grade reliability.


πŸš€ Key Features & Capabilities

⚑ Lightning-Fast Bulk Operations

🎯 Smart Message Filtering


πŸ›‘οΈ Enterprise-Grade Safety


πŸ” Intelligent Search & Preview

πŸ“Š Complete Workflow Management


πŸ§ͺ How It Works

Phase 1: Search Request

User: /cleanup "error messages"
Bot Response:
πŸ” Found 15 messages containing "error messages"
πŸ“Š Breakdown:
β€’ Will be permanently deleted
β€’ Cannot be undone
β€’ Respond within 5 minutes

βœ… Type: @cleaner_jedi yes
❌ Type: @cleaner_jedi cancel

Phase 2: User Confirmation

User: @cleaner_jedi yes
Bot: πŸ—‘οΈ Deleting 15 messages containing "error messages"

Phase 3: Completion

βœ… Cleanup Complete
β€’ 15 messages deleted
β€’ Channel cleaned
β€’ Auto-deletes this message in 5 seconds

πŸ› οΈ Technical Architecture

Core Components


πŸ“± User Commands

CommandDescriptionExample
/cleanup [term]Search messages containing [term]/cleanup "webhook error"
@cleaner_jedi yesConfirm deletionAfter preview
@cleaner_jedi cancelCancel pending deletionCancels active request

🧩 Edge Cases

ScenarioBot Response
No messages found”No messages found containing β€˜[term]β€˜β€œ
Expired confirmation”Request expired. Please run /cleanup again”
No pending request”No pending cleanup found. Run /cleanup first”
Invalid search term”Please provide a valid search term”

βš™οΈ Setup Requirements

Slack App Configuration

OAuth Scopes:

βœ… chat:write
βœ… chat:write.public
βœ… channels:history
βœ… groups:history
βœ… app_mentions:read
βœ… commands

Event Subscriptions:

βœ… app_mention
βœ… message.channels

Slash Command:

Command: /cleanup
URL: https://your-n8n.app.cloud/webhook/cleanerjedi
Hint: [search term]

n8n Workflow Setup

Required Nodes:


⚑ Advanced Features

🧠 Intelligent Deduplication

eventId = `cmd_${body.command}_${body.user_id}_${body.trigger_id}`;
if (staticData.recentEvents.includes(eventId)) {
  return []; // Skip duplicate
}

πŸ” Flexible Search Terms

♻️ Auto-Cleanup

setTimeout(() => {
  deleteMessage(completionMessage.ts);
  deleteMessage(progressMessage.ts);
}, 5000);

🧠 Storage Management


πŸ“Š Error Handling & Logging

Error Scenarios

❌ Invalid term
⏰ Expired request
🚫 Access denied
⚠️ Rate limit hit

Debugging & Monitoring


βœ… Usage Examples

Example 1: Delete Error Messages

/cleanup "error"
β†’ Bot: Found 23 messages
β†’ @cleaner_jedi yes
β†’ βœ… Deleted 23 messages

Example 2: Cancel Midway

/cleanup "from:@john"
β†’ Bot: Found 8 messages
β†’ @cleaner_jedi cancel
β†’ ❌ Operation cancelled

Example 3: Search by Date

/cleanup "2024-01-15"
β†’ Bot: Found 12 messages
β†’ @cleaner_jedi yes
β†’ βœ… 12 messages deleted

πŸ”’ Security & Safety


πŸš€ Performance Optimizations

Memory Handling:


πŸ“ˆ Monitoring & Analytics

Metrics Tracked

Logging

console.log('βœ… SUCCESS:', operationDetails);
console.warn('⚠️ WARNING:', warningDetails);
console.error('❌ ERROR:', errorDetails);
console.info('ℹ️ INFO:', informationDetails);

πŸŽ‰ Summary

For Users

For Admins

For Developers


PDF how to do Document Included

πŸ”— Nodes Used

Slack, Webhook

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup