GitHub webhooks to localhost for every developer
You are building something that reacts to GitHub: a bot that comments on pull requests, a deploy hook, a
GitHub App. Every developer on it needs real pull_request and push events on localhost, and GitHub sends
each webhook to one URL. This guide gives the whole team one stable payload URL and a copy of every delivery on
every laptop, without anyone taking the forwarding away from someone else.
GitHub facts below are from GitHub's documentation as of 2026-10-14, linked next to each claim.
What GitHub gives you, and where it stops
One URL per webhook. A repository or organization webhook has one payload URL, and a GitHub App has one webhook URL for the whole app. Pointing it at your tunnel points it away from your colleague's.
gh webhook forward is for one person. The GitHub CLI extension (gh extension install cli/gh-webhook)
forwards a repository's or organization's webhooks to your machine, but
"only one person can use webhook forwarding at a time for each repository and organization";
the second person gets Hook already exists. GitHub also says it is not supported in production.
No automatic retries. "GitHub does not automatically redeliver failed deliveries." A delivery that hit a closed laptop stays failed until someone with admin access redelivers it by hand, and only deliveries from the past three days can be redelivered.
A ten-second budget. GitHub expects a 2XX response within 10 seconds and counts anything slower as a failure — easy to exceed with a breakpoint in the handler.
Set up one inbox for the repository
A Tunnex inbox is a team-owned public URL that stores every request, answers GitHub immediately and delivers a copy to every developer who listens. Because the inbox answers, GitHub always gets its 2XX in time, even while your handler sits in the debugger.
1. Pick a webhook secret and create the inbox (one person, once):
pip install tunnex && tunnex login
tunnex teams create acme
export TUNNEX_INBOX_SECRET=$(openssl rand -hex 32) # keep it: GitHub and your handler need it too
tunnex inboxes create acme-github --team acme --provider github
tunnex inboxes create reads the secret from TUNNEX_INBOX_SECRET, so it stays out of your shell history.
2. Add the webhook in GitHub. In the repository's Settings → Webhooks → Add webhook:
- Payload URL:
https://acme-github.tunnex.org/webhooks/github(the path is kept and forwarded); - Content type:
application/json— the JSON filters below need a JSON body; - Secret: the value of
TUNNEX_INBOX_SECRET; - the events you need, or Send me everything.
GitHub sends a ping event when you save the webhook. It shows up in the inbox:
tunnex inboxes events acme-github # type, signature result, deliveries
3. Everyone listens, after joining the team with tunnex teams invite acme / tunnex teams join <link>:
tunnex listen acme-github --forward 8000
Each listener gets every delivery at http://localhost:8000/webhooks/github with GitHub's original headers —
X-GitHub-Event, X-GitHub-Delivery, X-Hub-Signature-256 — and the unchanged body. Two developers or
twenty: every listener gets its own copy.
Filter by event type
Most people work on one kind of event. Filters keep the rest away from their handler; a listener receives only events that match all of its filters (up to 10):
tunnex listen acme-github --forward 8000 --filter header.x-github-event=pull_request
tunnex listen acme-github --forward 8000 --filter header.x-github-event=pull_request --filter json.action=opened
tunnex listen acme-github --forward 8000 --filter header.x-github-event=push --filter json.ref=refs/heads/main
Header names are case-insensitive. JSON paths reach into the payload (json.repository.full_name=acme/api
on an organization webhook, json.sender.type!=Bot to skip bot activity), and ^= and *= match prefixes and
substrings. In tunnex inboxes events each GitHub event is listed by its type and action, for example
pull_request.opened.
Missed events and replays
The server keeps a cursor per listener. Close the laptop during a review, open it after lunch, and the
deliveries you missed arrive in order — no redelivery button involved, because GitHub's delivery to the inbox
succeeded. Catch-up is bounded by the inbox's retention (7 days by default) and 1,000 events per reconnect. Use
--from now to skip the backlog, or --from 2h to take only the last two hours.
To run your handler again against the same event:
tunnex inboxes event acme-github 1042 # headers, body, and every delivery to every listener
tunnex inboxes replay acme-github 1042 # deliver it again to your listeners
GitHub's signature has no timestamp, so a replayed event keeps its original X-Hub-Signature-256 and your
verification passes days later. Note that GitHub's own Recent deliveries page shows the inbox's answer, not
your handler's: when you debug a failing handler, look at the delivery log in tunnex inboxes event, the
console, or the local inspector at http://127.0.0.1:4040.
Verify the signature in your handler
The inbox checks X-Hub-Signature-256 at the edge and does not deliver events whose signature fails (they get
401 and are kept for inspection). Your handler should still verify, exactly as in production — the body
arrives byte for byte:
import hashlib
import hmac
def is_valid(secret: bytes, body: bytes, signature_header: str) -> bool:
expected = "sha256=" + hmac.new(secret, body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature_header)
Compute the HMAC over the raw request body, before any JSON parsing. Deliveries are at least once, so make the
handler idempotent on X-GitHub-Delivery (or on x-tunnex-event-id, which Tunnex adds).
GitHub Apps and organizations
A GitHub App has one webhook URL and one webhook secret for every installation. Set the URL to the inbox and
the secret to the inbox's secret, and the whole team develops against the same app. An organization webhook
works the same way; filter on json.repository.full_name when only one repository matters to you.
CI and staging
A test job can wait for the real webhook instead of a fixture. Give it a narrow token and a listener name of its own:
tunnex tokens create ci --scope listen --expires-in 30 # store it as TUNNEX_TOKEN in CI
tunnex listen acme-github --forward 3000 --from now --name "ci-$CI_JOB_ID" --no-inspector --quiet &
GitLab CI and GitHub Actions templates are in the examples, and a job can also read events through the HTTP API.
When gh webhook forward is enough
If you are the only one working on the integration and only need events while your terminal is open,
gh webhook forward --repo=acme/api --events=pull_request --url=http://localhost:8000/webhooks/github needs no
extra service. The inbox is for the moment a second person needs the same events, or an event must not be lost
while nobody is listening.