Discord Integration
Send approval requests to Discord channels and receive decisions via button interactions.
Features
- 📣 Posts approval requests with embeds
- ✅ Interactive Approve/Deny buttons
- 🔄 Updates messages after decision
- 🎨 Color-coded by urgency
Discord Bot Setup
1. Create a Discord Application
- Go to Discord Developer Portal
- Click New Application
- Name it (e.g., "AgentGate Approvals")
2. Create a Bot
- Go to the Bot section
- Click Add Bot
- Copy the Token (you'll need this)
3. Configure Permissions
Under OAuth2 → URL Generator:
- Select scopes:
bot,applications.commands - Select permissions:
- Send Messages
- Embed Links
- Use Slash Commands
- Read Message History
4. Invite to Server
- Copy the generated URL
- Open in browser and select your server
- Authorize the bot
5. Get Channel ID
- Enable Developer Mode in Discord (Settings → Advanced)
- Right-click the target channel → Copy ID
Configuration
bash
# Required
DISCORD_BOT_TOKEN=your-bot-token
DISCORD_DEFAULT_CHANNEL=123456789012345678 # Channel ID
# Optional
AGENTGATE_URL=http://localhost:3000Running
With Docker
bash
# Set credentials in .env
docker-compose --profile bots up -dStandalone
bash
DISCORD_BOT_TOKEN=... \
DISCORD_DEFAULT_CHANNEL=... \
AGENTGATE_URL=http://localhost:3000 \
npx @agentgate/discordMessage Format
Requests appear as rich embeds:
┌─────────────────────────────────────┐
│ 🔔 Approval Request │
├─────────────────────────────────────┤
│ Action: send_email │
│ Urgency: 🟡 Normal │
│ Request ID: req_abc123 │
│ │
│ Parameters: │
│ { │
│ "to": "user@example.com" │
│ } │
│ │
│ [✅ Approve] [❌ Deny] │
└─────────────────────────────────────┘Urgency colors:
- 🟢 Low — Green
- 🟡 Normal — Yellow
- 🟠 High — Orange
- 🔴 Critical — Red
Channel Routing
Route to specific channels:
bash
export CHANNEL_ROUTES='[
{
"channel": "discord",
"target": "123456789012345678",
"enabled": true
},
{
"channel": "discord",
"target": "987654321098765432",
"urgencies": ["high", "critical"],
"enabled": true
}
]'Slash Commands (Optional)
The bot can register slash commands:
| Command | Description |
|---|---|
/agentgate list | List pending requests |
/agentgate status <id> | Check request status |
To enable, add the applications.commands scope when inviting.
Troubleshooting
Bot offline
- Verify the token is correct
- Check that the bot has been added to the server
- Review logs for connection errors
Buttons not working
- Ensure the bot has "Read Message History" permission
- Verify the AgentGate server is accessible
- Check for interaction timeout (Discord has a 3-second limit)
Wrong channel
- Double-check the channel ID (not the name)
- Ensure the bot has access to the channel