GitHub Webhook
Receives webhook events from GitHub for connected repositories. Method:POST /api/v1/webhooks/github
Authentication: HMAC-SHA256 signature verification
This endpoint is called automatically by GitHub when PR events occur. You don’t need to call it directly.
Headers
HMAC-SHA256 signature of the request body using the webhook secret
Hook target type (
repository or integration). Nectr only accepts repository webhooks.GitHub event type (e.g.,
pull_request, push)Request Body
GitHub webhook payload (JSON). See GitHub webhook documentation for full schema.Signature Verification
In production (APP_ENV=production), Nectr verifies webhook signatures using HMAC-SHA256:
- Looks up the per-repo webhook secret from the database
- Computes expected signature:
sha256=<hmac_sha256(secret, body)> - Compares with
X-Hub-Signature-256header using constant-time comparison - Returns 403 if signatures don’t match
Supported Events
Nectr processes these pull request actions:- opened: New PR created
- synchronize: New commits pushed to PR branch
Response
Webhook processing status:
"received": Event logged but not processed"duplicate_skipped": Identical event already pending/processing"ignored": GitHub App event (not supported)
Internal event ID
Parsed event type (e.g.,
"opened_pull_request")Example Response
Background Processing
For PR events (opened or synchronize), Nectr:
- Returns 200 OK immediately (GitHub has a 10-second timeout)
- Marks event as
processing - Kicks off background task to perform AI code review (30-60 seconds)
- Posts review comment to GitHub when complete
Deduplication
If a pending or processing event already exists for the same PR (within the last hour), the webhook returns:Webhook Configuration
Webhooks are automatically created when you connect a repository viaPOST /api/v1/repos/{owner}/{repo}/install.
Webhook Settings
- Payload URL:
{BACKEND_URL}/api/v1/webhooks/github - Content type:
application/json - Secret: Randomly generated per repository (stored encrypted)
- Events: Pull requests, Pushes (configurable)
- Active: Yes
Testing Webhooks
You can manually trigger webhooks from GitHub:- Go to repository Settings → Webhooks
- Click on the Nectr webhook
- Scroll to Recent Deliveries
- Click Redeliver on any delivery
Troubleshooting
403 Invalid webhook signature- Webhook secret mismatch
- Check database
installations.webhook_secretmatches GitHub webhook configuration
- Nectr server not reachable at
BACKEND_URL - Check firewall, DNS, and SSL certificate
- Check
eventstable in database for received events - Verify
statusfield isprocessingorcompleted - Check server logs for background task errors