Webhooks Guide
Learn how to set up and use webhooks for real-time events
Overview
Webhooks allow you to receive real-time notifications when specific events occur. We support webhooks for GitHub events that are forwarded to Discord using the Bot API - no webhook URLs needed!
Available Webhooks
GitHub Webhooks
Receive notifications for GitHub repository events and forward to Discord.
POST /api/webhooks/services/github
Events: push, pull_request, issues, issue_comment, release
Universal Webhook Forwarder
Forward messages to Discord or Slack using the Bot API.
POST /api/webhooks?service=discord
Query params: service=discord|slack, channel=CHANNEL_ID
Dynamic Channel Selection
The webhook system automatically determines where to send messages:
- If
?channel=IDis provided in the URL - If
DISCORD_CHANNEL_OWNER_REPOenv var is set for the repo - Fallback: Bot automatically finds the first text channel in its server
This means you don't need to configure a default channel - just invite the bot and it will work!
Setup GitHub Webhook
- Go to your GitHub repository → Settings → Webhooks
- Click "Add webhook"
- Payload URL:
https://yourdomain.com/api/webhooks/services/github - Content type:
application/json - Secret:
GITHUB_WEBHOOK_SECRETvalue from your env - Select events you want to receive
- Click "Add webhook"
Setup Discord Bot
- Go to Discord Developer Portal
- Create a new application and add a bot
- Copy the bot token and add to env:
DISCORD_BOT_TOKEN - Add public key to env:
DISCORD_PUBLIC_KEY - Invite the bot to your server with appropriate permissions
- Enable "Server Members Intent" in Discord Developer Portal
⚠️ Important URL Configuration
In Discord Developer Portal → Your App → General Information:
- Interactions Endpoint URL:
https://yourdomain.com/api/webhooks/services/discord - Linked Roles Verification URL:
https://yourdomain.com/api/webhooks/services/discord?interaction_token=...
Per-Repository Channels
You can configure different Discord channels for different GitHub repositories:
# Environment variables format: DISCORD_CHANNEL_OWNER_REPO=123456789 # Example: DISCORD_CHANNEL_MYUSER_MYPROJECT=987654321 DISCORD_CHANNEL_OTHERUSER_OTHERPROJECT=555555555
Environment Variables
| Variable | Required | Description |
|---|---|---|
| DISCORD_BOT_TOKEN | Yes | Your Discord bot token |
| DISCORD_PUBLIC_KEY | Yes | Your Discord app's public key (from Developer Portal) |
| GITHUB_WEBHOOK_SECRET | Yes | Secret for GitHub webhook verification |
| DISCORD_CHANNEL_* | No | Per-repo channel mapping (format: OWNER_REPO) |
Usage Examples
GitHub → Discord (automatic)
# Just configure GitHub webhook: Payload URL: https://yoursite.com/api/webhooks/services/github Secret: (your GITHUB_WEBHOOK_SECRET) # Bot will auto-forward to Discord!
Manual webhook call
curl -X POST "https://yoursite.com/api/webhooks?service=discord&channel=123456789" \
-H "Content-Type: application/json" \
-d '{"content": "Hello from webhook!"}'