Slack Bot Integration¶
Slack bot that connects the DevOps agent platform to Slack. Messages in threads are routed to the ADK Runner, and responses are posted back in-thread. Guarded tools (@destructive, @confirm) post interactive Approve/Deny buttons.
Architecture¶
Slack message / @mention
→ Socket Mode (WebSocket) or HTTP webhook
→ slack-bolt event handler
→ ADK Runner (orrery-assistant root_agent)
→ AgentTools (kafka, k8s, docker, observability, journal)
→ sub-agents (incident triage workflow)
→ response posted in-thread
Guarded tools → Block Kit buttons [Approve] [Deny]
One Slack thread = one ADK session. New thread = fresh conversation.
Setup¶
For quick setup using the app manifest, see the Slack integration guide.
Manual setup (if not using manifest)¶
- Create a Slack app at api.slack.com/apps
- Enable Socket Mode → generate App-Level Token (scope:
connections:write) - Add bot scopes:
chat:write,channels:history,groups:history,im:history,app_mentions:read - Subscribe to events:
message.channels,message.groups,message.im,app_mention - Enable Interactivity
- Install to workspace
Environment¶
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_TOKEN=xapp-your-app-token # required for Socket Mode
GOOGLE_API_KEY=your-google-api-key
KAFKA_BOOTSTRAP_SERVERS=localhost:9092
PROMETHEUS_URL=http://localhost:9090
LOKI_URL=http://localhost:3100
ALERTMANAGER_URL=http://localhost:9093
Running¶
Socket Mode (local dev, no public URL needed)¶
Webhook mode (production)¶
Requires a public URL (e.g., ngrok). Set https://<host>/slack/events as the Request URL in Event Subscriptions and Interactivity.
Docker¶
How It Works¶
Confirmation Buttons¶
When the agent invokes a tool marked with @destructive or @confirm:
- A Block Kit message with Approve / Deny buttons is posted to the thread
- Approve → agent re-invokes the tool (now allowed through)
- Deny → agent skips the operation
Destructive tools show :warning:, confirm tools show :large_blue_circle:.
Session Management¶
| Concept | Mapping |
|---|---|
| Slack thread | ADK session |
| Slack user ID | ADK user ID |
| New thread | New session |
| Reply in thread | Continues session |
Sessions are in-memory by default; set SLACK_DB_URL or DATABASE_URL to a PostgreSQL URL to persist them.
Configuration Reference¶
| Variable | Default | Description |
|---|---|---|
SLACK_BOT_TOKEN | — | Bot User OAuth Token (xoxb-...) |
SLACK_SIGNING_SECRET | — | App signing secret |
SLACK_APP_TOKEN | — | App-level token for Socket Mode (xapp-...) |
SLACK_BOT_PORT | 3000 | Port for webhook mode |
SLACK_DB_URL | (empty → in-memory) | PostgreSQL session URL; DATABASE_URL takes precedence |
Testing¶
35 tests, all mocked — no running Slack or infrastructure required.