How to Test GitHub Webhooks: Complete Guide
How to inspect GitHub deliveries during development, verify signatures, and handle the event quirks that show up in real repositories.
GitHub Webhook Basics
GitHub webhooks power a lot of engineering automation: CI/CD triggers, deployment bots, issue sync, release workflows, and notifications. The request usually looks straightforward until a branch is force-pushed, a PR changes state, or GitHub resends a delivery you were not expecting.
Real deliveries matter for this reason. GitHub payloads vary slightly across event actions, and those small differences are often what break brittle handlers.
Key GitHub Webhook Events
| Event | Trigger | Use Case |
|---|---|---|
push | Code pushed to any branch | CI/CD triggers, auto-deploy |
pull_request | PR opened, closed, merged | Code review bots, notifications |
issues | Issue created, edited, closed | Project management sync |
release | Release published | Auto-publish, changelog |
workflow_run | GitHub Action completed | Post-CI notifications |
star | Repository starred | Analytics, notifications |
Step-by-Step: Test GitHub Webhooks with Requex.me
- Get your test URL: Visit requex.me and copy your unique webhook URL.
- Configure GitHub: Go to your repository → Settings → Webhooks → Add webhook. Paste your Requex URL in the "Payload URL" field. Set Content type to
application/json. Choose which events to receive. - Set a secret: Enter a webhook secret (any random string). You'll use this to verify signatures in production.
- Trigger an event: Make a commit, open a PR, or create an issue. The webhook payload appears instantly in your Requex dashboard.
- Inspect the payload: Click on the request to review the full JSON body, the
X-GitHub-Eventheader, the signature header, and the delivery ID GitHub assigns.
GitHub Webhook Signature Verification
GitHub signs each webhook delivery using your secret. The signature is sent in the X-Hub-Signature-256 header as a SHA-256 HMAC hex digest.
// Node.js verification
const crypto = require('crypto');
function verifyGitHubSignature(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
// Usage in Express
app.post('/webhooks/github', express.raw({type: '*/*'}), (req, res) => {
const sig = req.headers['x-hub-signature-256'];
if (!verifyGitHubSignature(req.body, sig, process.env.GITHUB_WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
const event = req.headers['x-github-event'];
const payload = JSON.parse(req.body);
switch(event) {
case 'push':
console.log('Push to', payload.ref);
break;
case 'pull_request':
console.log('PR', payload.action, payload.pull_request.title);
break;
}
res.status(200).send('OK');
});GitHub-Specific Tips
Use the X-GitHub-Event header
Unlike most providers where the event type is in the body, GitHub puts it in the X-GitHub-Event header. Always use this header to route events to the appropriate handler.
Redeliver from GitHub
GitHub keeps a delivery log for every webhook. Go to Settings → Webhooks → Recent Deliveries to see the payload, response, and redeliver any failed event. This is invaluable for debugging production issues.
Handle the action field
Many GitHub events have an action field (e.g., "opened", "closed", "reopened" for pull_request events). Always check this field: don't assume a pull_request event means a new PR was opened.
GitHub sends a ping event first
When you first configure a webhook, GitHub sends a ping event to verify your endpoint is reachable. Make sure your handler returns 200 OK for ping events.
401 Unauthorized errors from GitHub
If your endpoint returns 401, GitHub will mark the delivery as failed and retry. This typically means your handler rejected the request before processing the payload. See the webhook 401 unauthorized guide for step-by-step diagnosis.
Node.js GitHub Webhook Handler
The code examples above are in Node.js. For a complete guide with Express middleware, HMAC verification, and event routing patterns, see the Node.js webhook testing guide.
Start Testing Webhooks Now
Generate your unique URL and test webhooks instantly. Free, no signup.
Open Webhook Tester →