Setting up GitHub Webhook Integration with Discord
Step 1: Create the Webhook in Discord
You first need a unique, secret URL from Discord that GitHub can send data to.
- Navigate to your Discord server and the specific text channel (e.g.,
#dev-alerts). - Go to Channel Settings → Integrations → Webhooks.
- Click New Webhook.
- Click Copy Webhook URL.
⚠️ SECURITY WARNING: Treat this URL like a password. Anyone who has it can post messages to your channel. Do not commit it directly to a public repository.
Step 2: Configure the GitHub Repository
Now, connect that Discord URL to your repo’s settings.
-
Open your GitHub repository and go to Settings → Webhooks.
-
Click the Add webhook button.
-
Configure the Webhook Fields:
- Payload URL: Paste the Discord URL here. You must append
/githubto the very end.- Example:
https://discord.com/api/webhooks/.../token/github
- Example:
- Content type: Set this to
application/json(usually the default). - Secret: Leave this field blank.
- Which events would you like to trigger this webhook?
- For a simple setup, select “Just the push event.”
- Send me everything “Pushes notification of Everything”
- For detailed alerts, select “Let me select individual events” and check Pushes, Pull requests, and Issues.
- Payload URL: Paste the Discord URL here. You must append
-
Ensure the Active box is checked.
-
Click Add webhook.
Step 3: Test the Integration
- After adding the webhook, GitHub automatically sends a test payload. Check your Discord channel for a successful confirmation message.
- Perform a test action on your repo (e.g., starred your repository or push a commit).
- You should see a notification appear in your Discord channel immediately..