GitHub Webhook Integration
GitHub webhooks allow you to build or set up integrations that subscribe to certain events on GitHub. When one of those events is triggered, GitHub sends an HTTP POST payload to the webhook’s configured URL.Quick Start
- Get your Unhook URL:
https://unhook.sh/wh_YOUR_ID - Configure in GitHub: Repository Settings → Webhooks
- Start receiving events:
unhook listen
Configuration Steps
Repository Webhooks
1. Navigate to Webhook Settings
- Go to your repository on GitHub
- Click Settings → Webhooks
- Direct link:
https://github.com/YOUR_USERNAME/YOUR_REPO/settings/hooks
2. Add a New Webhook
- Click “Add webhook”
- Enter your Unhook URL in Payload URL:
- Set Content type to
application/json - Enter a Secret (optional but recommended for security)
- Choose events to trigger the webhook
3. Select Events
Choose “Let me select individual events” to pick specific events:Repository Events
push- Git push to repositorypull_request- PR opened, closed, synchronized, etc.pull_request_review- PR review submittedpull_request_review_comment- Comment on PR codeissues- Issue opened, closed, labeled, etc.issue_comment- Comment on issues/PRscreate- Branch or tag createddelete- Branch or tag deletedfork- Repository forkedstar- Repository starred (watch events)
Workflow Events
workflow_run- Workflow run completedworkflow_job- Workflow job queued, in progress, or completedcheck_run- Check run created, updated, or completedcheck_suite- Check suite completedstatus- Commit status updated
Release Events
release- Release published, unpublished, created, edited, deleteddeployment- Deployment createddeployment_status- Deployment status updated
Collaboration Events
member- Collaborator added, removed, or permissions changedteam_add- Repository added to teamrepository- Repository created, deleted, archived, unarchived
Organization Webhooks
1. Navigate to Organization Settings
- Go to your organization page
- Click Settings → Webhooks
- Direct link:
https://github.com/organizations/YOUR_ORG/settings/hooks
2. Configure Organization Webhook
Follow similar steps as repository webhooks, with additional organization-specific events:organization- Organization member added/removedteam- Team created, deleted, editedmembership- Team membership changedrepository- Repository created/deleted in orgproject- Project board created, edited, closed
Event Payload Examples
Push Event
Pull Request Event
Workflow Run Event
Webhook Security
Verifying Webhook Signatures
GitHub signs webhook payloads using HMAC-SHA256:IP Allowlisting
GitHub webhooks come from specific IP ranges. You can retrieve these using:hooks array in the response.
Testing Webhooks
Using GitHub’s Redelivery Feature
- Go to Settings → Webhooks → Recent Deliveries
- Click on a delivery
- Click “Redeliver” to resend the webhook
Creating Test Events
Trigger webhooks by performing actions:- Push commits to trigger
pushevents - Open/close issues for
issuesevents - Create pull requests for
pull_requestevents
Using the GitHub API
Best Practices
1. Handle Events Asynchronously
2. Filter by Action
Many events have sub-actions:3. Store Delivery IDs
Prevent duplicate processing:Common Use Cases
CI/CD Integration
PR Automation
Issue Management
Troubleshooting
Webhook Not Triggering
- Verify the webhook is active (green checkmark in settings)
- Check “Recent Deliveries” for error responses
- Ensure you’ve selected the correct events
- Verify your server is accessible from the internet
Payload Too Large
- GitHub limits payloads to 25MB
- For large events, use the API to fetch full data
- Consider filtering events to reduce payload size
Rate Limiting
- GitHub doesn’t rate limit webhook deliveries
- But your server might hit API rate limits when responding
- Use conditional requests and caching when fetching additional data
Useful Links
- GitHub Webhooks Documentation: docs.github.com/en/developers/webhooks-and-events/webhooks
- Webhook Events Reference: docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
- GitHub API Documentation: docs.github.com/en/rest
- Webhook Debugging: docs.github.com/en/developers/webhooks-and-events/webhooks/testing-webhooks
Support
Need help with GitHub webhooks?- Join our Discord community
- Check GitHub’s documentation
- Email us at support@unhook.sh