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