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)
}