Slack Integration
AI Intern connects directly to your team Slack workspace. Developers can trigger coding tasks, inspect plans, and grant approval directly in thread conversations.
Architecture
Section titled “Architecture”The Slack integration is powered by the Orchestrator Worker and Durable Objects:
- Inbound Webhook: Slack sends event notifications (
app_mentionor direct message) toPOST /api/slack/events. - Signature Verification: The Worker validates the
X-Slack-Signatureand timestamp using your configuredSLACK_SIGNING_SECRET. - Task Coordination: The CodingOrchestrator parses the prompt, identifies referenced GitHub repositories, and formulates a plan.
- Interactive Card: Slash commands reply with a Block Kit card. Mentions post via
SLACK_BOT_TOKEN(chat.postMessage) on the thread DO namedslack:{team}:{channel}:{thread_ts}. Empty bot token: no card, no run. - Repo resolution: GitHub URL in the mention/thread, else
SLACK_CHANNEL_REPOS, else an in-thread ask — never a guessed repo.
Setup Instructions
Section titled “Setup Instructions”-
Create a Slack App Fastest: at api.slack.com/apps choose Create New App → From a manifest and paste
slack-app-manifest.yamlfrom the repository root — it declares the scopes,app_mentionevent,/ai-interncommand, and interactivity below. Edit the twoyour-worker.workers.devURLs to your Worker hostname. Manual alternative: -
Configure Bot Token Scopes Under OAuth & Permissions, add the following Bot Token Scopes:
chat:write(post messages and replies)app_mentions:read(listen for @AI Intern mentions)channels:history(read thread context)
-
Enable Event Subscriptions Set the Request URL to your Cloudflare Worker endpoint:
https://your-worker.workers.dev/api/slack/eventsSubscribe to bot events:
app_mention. -
Enable Interactivity Under Interactivity & Shortcuts, enable interactivity and set the Request URL:
https://your-worker.workers.dev/api/slack/interact -
Store Secrets with Wrangler Set the secrets in your Cloudflare environment:
Terminal window pnpm wrangler secret put SLACK_BOT_TOKENpnpm wrangler secret put SLACK_SIGNING_SECRETMentions need
SLACK_BOT_TOKEN. Map channels to repos with theSLACK_CHANNEL_REPOSvar ({"C123":"https://github.com/owner/repo"}).SLACK_APPROVERSis a comma-separated list of Slack user ids; unset means nobody can approve.
Example Interaction
Section titled “Example Interaction”In any public or private channel where the bot is invited:
Developer:
@AI Intern fix the typo in README.md and add pnpm instructionsAI Intern: 📋 Delegation Plan Prepared
- Target:
princepal9120/ai-intern(mainbranch)- Action: Update
README.md- Test Command:
pnpm test[ Approve Run ] [ Reject ]
Once approved, AI Intern spins up an isolated sandbox container, runs the changes, and posts the resulting GitHub PR link directly in the thread.
