Skip to content

rudimocnik/slacking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Slack DM Message Deletion Tool

Simple interactive tool to delete all your messages (including threaded replies) in a Slack direct message conversation with a specific person.

Quick Start

1. Install dependency

pip install slack-sdk

2. Get your Slack token

  1. Go to https://api.slack.com/apps
  2. Click "Create New App" → "From scratch"
  3. Give it a name and select your workspace
  4. Click "OAuth & Permissions" in the sidebar
  5. Under "User Token Scopes" (not Bot or App-Level), add these scopes:
    • channels:history - View messages in channels
    • channels:read - View basic channel info
    • groups:history - View messages in private channels
    • im:history - View messages in DMs
    • im:read - View basic DM info
    • mpim:history - View messages in group DMs
    • chat:write - Delete messages
    • users:read - View people in workspace
    • users:read.email - View email addresses
  6. Click "Install to Workspace" and authorize
  7. Copy the "User OAuth Token" (starts with xoxp-)

3. Set your token

export SLACK_USER_TOKEN='xoxp-your-token-here'

4. Run the script

Interactive mode (recommended):

python /tmp/delete_slack_dm.py

The script will:

  1. Show you a list of all your DM conversations
  2. Let you pick one by number or name
  3. Show you a preview of your messages
  4. Ask for confirmation before deleting

With a specific person:

python /tmp/delete_slack_dm.py "John Doe"

Dry run (test without deleting):

python /tmp/delete_slack_dm.py --dry-run

What It Does

✅ Deletes only YOUR messages, not the other person's
✅ Deletes messages in threads too
✅ Shows preview before deleting
✅ Requires typing 'DELETE' to confirm
✅ Handles rate limits automatically

Example Session

============================================================
  Slack DM Message Deletion Tool
============================================================

✓ Authenticated as: John Smith

Fetching your DM conversations...

📋 Your DM conversations (15 total):
   1. Alice Johnson (@alice)
   2. Bob Williams (@bob)
   3. Carol Davis (@carol)
   ...

============================================================

Enter the number or name of the person: 2

👤 Selected: Bob Williams (@bob)

📥 Fetching messages...
   Fetched 247 messages so far...

📊 Found 143 message(s) from you

📝 Preview of messages to delete:
   1. [2024-01-15 14:30] Hey, did you see the report?
   2. [2024-01-15 14:32] [in thread] Yeah, looks good
   3. [2024-01-16 09:15] Morning! Quick question...
   ... and 140 more

⚠️  WARNING: This will PERMANENTLY delete these messages!
Type 'DELETE' to confirm: DELETE

🗑️  Deleting messages...
   Deleted 50/143...
   Deleted 100/143...
   Deleted 143/143...

✅ Done! Deleted 143 messages

============================================================
  Done!
============================================================

Important Notes

  • ⚠️ Deletion is permanent - cannot be undone
  • ⚠️ Only deletes your messages (verified by user ID)
  • ⚠️ Deletes all your messages including thread replies
  • ⚠️ The other person's messages remain untouched
  • ⏱️ Large conversations may take a while (rate limiting)

Troubleshooting

"SLACK_USER_TOKEN not set"

  • Make sure you exported the token in your current terminal session

"No DM conversations found"

  • Make sure you have some DM conversations in Slack
  • Check that your token has the correct scopes

"Authentication failed"

  • Your token might be invalid or expired
  • Make sure you copied the entire token (they're quite long!)
  • Verify you're using a User OAuth Token, not a Bot Token

Rate limiting

  • The script automatically handles this
  • Just wait, it will continue after the delay

Safety Features

  • Interactive confirmation required
  • Shows preview of what will be deleted
  • Must type 'DELETE' (all caps) to confirm
  • Dry run mode available for testing
  • Progress reporting during deletion

License

Provided as-is for personal use. Use at your own risk.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages