Discord Integration
Connect a Discord server to CrewForm so users can trigger agents and pipeline teams directly from Discord using slash commands.How It Works
CrewForm’s Discord integration uses a slash command bot registered in the Discord Developer Portal. Once connected, users can run:| Command | Description |
|---|---|
/connect code:<code> | Link a Discord channel to a CrewForm output route |
/ask prompt:<question> | Send a task to the connected agent or pipeline team |
Setup: Managed Bot (Recommended)
The managed bot uses CrewForm’s own Discord application. No separate bot registration needed.Step 1: Invite the Bot
Before connecting, invite the CrewForm bot to your Discord server:- Go to Settings → Channels in CrewForm
- Click Add Channel → Discord
- Click the Invite Bot link shown in the setup panel
- Select your Discord server and authorise the bot (requires
Manage Serverpermission)
⚠️ The bot must be invited before you can use /connect. If you skip this step, slash commands won’t appear in your server.
Step 2: Get Your Connect Code
- In Settings → Channels, click New Channel and choose Discord
- Toggle Managed Bot on
- Optionally set a Default Agent or Default Team — this is what
/askwill call - Save the channel — a connect code is generated
Step 3: Connect the Discord Channel
In your Discord server:Step 4: Test It
⏳ Processing your request... then follow up with the agent’s response.
Setup: Bring Your Own Bot (BYOB)
If you want full control over the Discord application (custom name, avatar, permissions), you can register your own bot.1. Create a Discord Application
- Go to discord.com/developers/applications
- Click New Application → give it a name (e.g., “My CrewForm Bot”)
- Go to Bot tab → click Add Bot
- Copy the Bot Token
- Go to General Information → copy the Public Key
2. Register Slash Commands
Run this once to register the/connect and /ask commands on your bot:
3. Set the Interactions Endpoint
- In the Discord Developer Portal, go to General Information
- Set Interactions Endpoint URL to:
- Click Save — Discord will ping the URL to verify Ed25519 signature verification
⚠️ Discord requires a validDISCORD_PUBLIC_KEYenvironment variable on your Supabase project for this step to pass. Set it in your Supabase project’s Edge Function secrets or your self-hosted.env.
4. Configure in CrewForm
In Settings → Channels → New Channel → Discord:- Toggle Managed Bot OFF
- Paste your Bot Token and Guild ID
- Set a Default Agent or Team
- Invite your bot to your Discord server with the OAuth2 URL from the Developer Portal
Environment Variables
| Variable | Required | Description |
|---|---|---|
DISCORD_BOT_TOKEN | Managed mode only | Token for the shared CrewForm bot |
DISCORD_PUBLIC_KEY | BYOB mode (Ed25519 verification) | Public key from Discord Developer Portal |
.env file. See the Self-Hosting Guide.
Troubleshooting
/connect or /ask commands don’t appear in my server
The bot hasn’t been invited, or slash commands haven’t been registered yet. Follow Steps 1–2 in the managed bot setup, or re-run the curl commands in the BYOB setup.
”Invalid connect code” error
- Double-check the code from Settings → Channels — codes are single-use and expire if not used
- Ensure the channel platform is set to Discord in CrewForm
”No agent configured” error
The channel’s/connect was completed but no Default Agent or Default Team was assigned. Go to Settings → Channels, edit the channel, and set a default.
Discord responds with 401 Unauthorized
TheDISCORD_PUBLIC_KEY environment variable is missing or incorrect. Verify it matches the Public Key in your Discord Developer Portal → General Information.
Responses time out or never arrive
CrewForm uses deferred responses — Discord shows “thinking…” while the task runs. If no followup arrives:- Check task-runner logs:
docker compose logs -f task-runner - Ensure the task-runner has a valid LLM API key for the assigned agent’s provider
Related
- Channels — Overview of all inbound channels (Telegram, Slack, Email)
- Output Routes — Push agent results outbound to Discord and other destinations

