Slack Integration¶
Internal tooling via HTTP-based slash commands and interactive components.
Available Commands¶
/pr-hello— Simple greeting command for testing/pr-orgs— List all organizations with ID, name, and URL/pr-org <id|name>— Detailed organization info and audit data- Accepts numeric org ID or fuzzy-matched name
- Shows basic info immediately, sends audit data as follow-up
- Presents confirmation buttons for ambiguous name matches
Slack App Configuration¶
- Request URL:
https://your-domain.com/api/v1/slackfor slash commands - Interactivity Request URL:
https://your-domain.com/api/v1/slack/interactivefor button interactions - Scopes:
chat:write,commands,users:read,users:read.email
Required Environment Variables¶
Optional configuration:
SLACK_FUZZY_MATCH_THRESHOLD=75.0 # Name match confidence (0-100, default: 75)
SLACK_RATE_LIMIT_REQUESTS=30 # Requests per window (default: 30)
SLACK_RATE_LIMIT_WINDOW=60 # Window in seconds (default: 60)
SLACK_CACHE_TTL_ORGANIZATIONS=300 # Org data cache TTL (default: 5 min)
SLACK_CACHE_TTL_AUDIT=1800 # Audit data cache TTL (default: 30 min)
Rate Limiting¶
Redis-based distributed rate limiting per Slack team ID. Returns HTTP 429 with retry-after headers when exceeded.
Caching¶
Redis-based caching with slack: key prefix:
- Organization data: 5 min default
- Audit data: 30 min default
Local Testing¶
- Set up a development Slack app in your workspace
- Point Request URLs to your local server (use ngrok)
- Install the app and test commands in any channel
Key Files¶
app/methods/slack.py— Command handlersapp/routes/slack_app_routes.py— Flask routesapp/core/utils/rate_limiter.py— Rate limitingapp/routes/schemas.py— Request/response schemas