Discord Webhook Configuration
This guide explains how to set up separate Discord webhooks for commits vs. deployments.
Why Separate Webhooks?
- Commits channel (
#commits): Shows all pushes tomain/devbranches - Deployments channel (
#deployments): Shows deployment status (success/failure) to staging and production
This separation reduces noise and makes it easier to track what's deployed vs. what's committed.
Setup Instructions
1. Create Discord Channels
In your Discord server:
Create two new channels:
#commits(Private to team)#deployments(Private to team)
Set channel permissions (optional but recommended):
- Make channels read-only for regular members
- Only webhook bot can post
2. Create Webhooks
For each channel:
- Settings → Integrations → Webhooks
- Click New Webhook
- Name it (e.g., "Lantern GitHub Bot")
- Select the channel
- Click Copy Webhook URL
Result:
#commits channel → DISCORD_WEBHOOK_COMMITS
#deployments channel → DISCORD_WEBHOOK_DEV_DEPLOY, DISCORD_WEBHOOK_PROD_DEPLOY3. Add Secrets to GitHub
In GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
Add these secrets:
DISCORD_WEBHOOK_COMMITS
├─ URL from #commits webhook
DISCORD_WEBHOOK_DEV_DEPLOY
├─ URL from #deployments webhook (used for dev.ourlantern.app)
DISCORD_WEBHOOK_PROD_DEPLOY
├─ URL from #deployments webhook (used for ourlantern.app)Note: DISCORD_WEBHOOK_DEV_DEPLOY and DISCORD_WEBHOOK_PROD_DEPLOY can point to the same Discord channel if you prefer, or different channels for separation.
Webhook URLs Format
Each webhook URL looks like:
https://discordapp.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN⚠️ Keep these secret! Never commit to git or share publicly.
Deprecation
The old DISCORD_WEBHOOK_URL secret is deprecated and should be removed after migration:
- Delete from GitHub Secrets
- Verify all workflows use the new secrets
- Remove any references from documentation
Testing Webhooks
To test a webhook manually:
bash
curl -X POST https://discordapp.com/api/webhooks/YOUR_ID/YOUR_TOKEN \
-H 'Content-Type: application/json' \
-d '{
"username": "Test Bot",
"content": "Test message from GitHub Actions"
}'Expected response: 204 No Content (success)
Troubleshooting
Webhook returns 404
- Webhook URL is incorrect or expired
- Channel was deleted
- Fix: Create a new webhook and update the secret
Webhook returns 401
- Webhook token is invalid or revoked
- Fix: Recreate the webhook
Messages not appearing
- Check webhook is in correct channel
- Verify bot has permission to post in channel
- Check Discord server notifications aren't muted
Rate limiting (429)
- Too many requests to Discord API
- GitHub Actions is sending too many notifications
- Fix: Batch multiple commits in one message (already implemented)
See Also
- CICD_GUIDE.md - Full CI/CD documentation
- deploy-dev.yml - Development deployment workflow
- deploy-prod.yml - Production deployment workflow
- discord-notify.yml - Commit notification workflow