Skip to content

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/slack for slash commands
  • Interactivity Request URL: https://your-domain.com/api/v1/slack/interactive for button interactions
  • Scopes: chat:write, commands, users:read, users:read.email

Required Environment Variables

SLACK_BOT_TOKEN=xoxb-your-bot-token-here
SLACK_SIGNING_SECRET=your-signing-secret-here

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

  1. Set up a development Slack app in your workspace
  2. Point Request URLs to your local server (use ngrok)
  3. Install the app and test commands in any channel

Key Files

  • app/methods/slack.py — Command handlers
  • app/routes/slack_app_routes.py — Flask routes
  • app/core/utils/rate_limiter.py — Rate limiting
  • app/routes/schemas.py — Request/response schemas