Integration
How to Set Up GitHub Webhooks
2026-04-15Β·6 min
HS
By HookSniff Team
Engineering Β· Published on 2026-04-15
#github#integration#ci-cd
GitHub webhooks let you react to events in your repositories β pushes, pull requests, issues, deployments, and more.
Setting Up
- Go to Settings β Webhooks β Add webhook
- Set Payload URL to your HookSniff endpoint
- Choose Content type: application/json
- Select events: push, pull_request, issues, deployment
- Save
Verifying GitHub Signatures
GitHub signs payloads with HMAC-SHA1 using your webhook secret. HookSniff verifies this automatically.
Common Use Cases
- **CI/CD** β Trigger builds on push
- **Notifications** β Alert team on PR reviews
- **Automation** β Auto-merge dependabot PRs
- **Analytics** β Track commit frequency
Code Example
go10 lines
func handleGitHubWebhook(w http.ResponseWriter, r *http.Request) {
event := r.Header.Get("X-GitHub-Event")
switch event {
case "push":
triggerBuild(payload)
case "pull_request":
reviewPR(payload)
}
w.WriteHeader(200)
}