A Slack bot for managing test environment queues with automatic tag assignment and expiration.
- Queue management for test environments
- Automatic tag assignment and expiration (30-second intervals)
- User position tracking and wait time estimation
- Admin privilege system with visual indicators
- Interactive Slack UI with contextual buttons
- Silent status updates (no channel spam)
- Background expiration service for automatic cleanup
When setting up the bot for the first time, you need to configure at least one admin user:
-
Get your Slack User ID:
- Go to your Slack profile
- Click "More" → "Copy member ID"
- Your user ID will look like
U095P7EPAT1
-
Set the bootstrap admin environment variable:
export ADMIN_USER_ID=U095P7EPAT1 # Replace with your actual user ID
-
Start the bot:
ADMIN_USER_ID=U095P7EPAT1 go run main.go # or with the compiled binary: ADMIN_USER_ID=U095P7EPAT1 ./slack-queue-bot
-
Verify admin access:
- Use
@bot help
in your Slack channel - You should see the "🔑 Admin Commands" section
- Your status messages will show a crown (👑) indicator
- Use
Once you have admin access, you can manage other admin users:
# List current admins
@bot manage-admins list
# Add a new admin (supports @mentions)
@bot manage-admins add @username
@bot manage-admins add U123456789
# Remove an admin
@bot manage-admins remove U123456789
Note: You cannot remove yourself if you're the only admin.
Admins have access to additional commands and visual indicators:
- 👑 Crown emoji next to admin names in status messages
- "👑 Admin controls visible" context in status displays
- Dedicated "🔑 Admin Commands" section in help
@bot assign
- Manually assign next user in queue@bot force-cleanup
- Force immediate cleanup of expired tags@bot clear [queue|tags|all]
- Clear queue and/or release tags@bot manage-admins [list|add|remove]
- Manage admin privileges
For better clarity, the following aliases are available:
@bot force-cleanup
(alias forcleanup
)@bot clear
(alias forclean
)@bot manage-admins
(alias foradmin
)
The bot uses a database to store configuration settings for test environments, tags, and settings. Configuration is managed through database operations.
max_queue_size
: Maximum number of users in queuedefault_duration
: Default assignment durationmax_duration
: Maximum allowed assignment durationexpiration_check
: Background expiration check interval (30 seconds)admin_users
: Admin user IDs (managed via bot commands)
# Install dependencies
go mod download
# Run the bot
go run main.go
# Build binary
go build -o slack-queue-bot .
SLACK_BOT_TOKEN
: Your Slack bot tokenSLACK_APP_TOKEN
: Your Slack app token for socket modeSLACK_CHANNEL_ID
: Channel ID where the bot operatesADMIN_USER_ID
: Bootstrap admin user ID (first-time setup only)DATA_DIR
: Directory for data storage (default: "./data")