Configuring GitHub Webhooks
Introduction
Section titled “Introduction”Webhooks send HTTP POST payloads to external URLs when repository events occur, enabling integrations with other systems.
Create a Webhook
Section titled “Create a Webhook”- Go to Settings > Webhooks and click Add webhook.
- Enter the payload URL of your application.
- Choose the content type, usually
application/json
. - Provide a secret token to sign payloads for verification.
- Select individual events or Send me everything.
- Click Add webhook to save.
Verify Payloads
Section titled “Verify Payloads”Use the secret token to validate the signature:
const crypto = require('crypto');const signature = 'sha256=' + crypto .createHmac('sha256', secret) .update(body) .digest('hex');
Common Use Cases
Section titled “Common Use Cases”- Trigger CI/CD pipelines
- Post messages to chat applications
- Synchronize issues with project management tools