Overview
Webhooks send POST requests to your specified URL when events like pushes, pull requests, or issues occur. Use webhooks to:- Trigger CI/CD pipelines
- Update external systems
- Send notifications to chat platforms
- Sync data with other services
Events
Webhooks can subscribe to the following events:| Event | Description |
|---|---|
push | Commits pushed to a branch |
pull_request | PR opened, closed, merged, or updated |
pull_request_review | Review submitted on a PR |
issue | Issue created, closed, or updated |
issue_comment | Comment on an issue or PR |
create | Branch or tag created |
delete | Branch or tag deleted |
fork | Repository forked |
star | Repository starred |
Endpoints
List Webhooks
List all webhooks for a repository. Requires write permission.Get Webhook
Get a specific webhook. Requires write permission.Create Webhook
Create a new webhook. Requires admin permission.Update Webhook
Update an existing webhook. Requires admin permission.Delete Webhook
Delete a webhook. Requires admin permission.Test Webhook
Send a test ping to the webhook. Requires admin permission.Webhook Payloads
Common Fields
All webhook payloads include:Push Event
Pull Request Event
Issue Event
Signature Verification
If you set a secret, wit signs webhook payloads using HMAC-SHA256.Headers
| Header | Description |
|---|---|
X-Wit-Signature | HMAC-SHA256 signature |
X-Wit-Event | Event type |
X-Wit-Delivery | Unique delivery ID |
Verifying Signatures
Error Handling
| Error Code | Description |
|---|---|
NOT_FOUND | Repository or webhook not found |
FORBIDDEN | Insufficient permissions |
BAD_REQUEST | Invalid events or URL |
CONFLICT | Webhook URL already exists |
Usage Examples
Setting Up CI Webhooks
Slack Notifications
React Management Component
Best Practices
Security
- Always use HTTPS URLs for webhook endpoints
- Set a secret and verify signatures
- Validate the event type before processing
- Use unique delivery IDs to prevent replay attacks
Reliability
- Respond quickly (within 10 seconds) to avoid timeouts
- Process asynchronously for heavy operations
- Implement idempotency to handle duplicate deliveries
- Log delivery IDs for debugging