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

  1. Go to Settings โ†’ Webhooks โ†’ Add webhook
  2. Set Payload URL to your HookSniff endpoint
  3. Choose Content type: application/json
  4. Select events: push, pull_request, issues, deployment
  5. 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)
}
How to Set Up GitHub Webhooks โ€” HookSniff Blog | HookSniff