Skip to main content
Webhooks let external services push events to you the moment something happens, like a GitHub star, a Slack message, or a PR merged. You expose one endpoint. Corsair verifies the signature, identifies the plugin, and calls your handler. Three steps: ngrok, register, react.

Step 1: expose a public URL

GitHub and Slack can’t reach localhost. Use ngrok to tunnel your local server:
You’ll get a URL like https://abc123.ngrok-free.app. Copy it.
Get a stable URL (recommended) Free ngrok accounts get a random URL on every restart, so you’d have to re-register your webhook every time. Claim a free static domain at dashboard.ngrok.com/domains and it’ll never change.

Step 2: create the webhook endpoint

Add one route to your server. All plugins share this single URL:
app/api/webhook/route.ts
processWebhook handles everything: it identifies which plugin sent the event, verifies the signature, updates your local database, and runs your hooks.

Step 3: register and react

Register in GitHub:
  1. Go to your repo, then Settings, Webhooks, Add webhook
  2. Set Payload URL: https://your-ngrok-url.ngrok-free.app/api/webhook
  3. Set Content type: application/json
  4. Add a Secret, then save it
  5. Choose events (or “Send me everything”)
  6. Click Add webhook
Store the secret:Pass the secret to the plugin in createCorsair. Corsair uses it to verify incoming webhook signatures.
corsair.ts
React to events:
corsair.ts

How it works

Every plugin shares the same endpoint. You never write routing logic. processWebhook returns plugin and action for the webhook that matched (plugin is null when none did), and a response to send back: Set responseHeaders on the HTTP response too: a few providers (Asana’s X-Hook-Secret handshake) need them. With multiTenancy, a URL that names no tenantId doesn’t fall back to the default tenant blindly. Corsair asks the plugin that matched which account the delivery belongs to and uses the tenant linked to it. It uses default only when no tenant is linked, and refuses the delivery with a 500 if the lookup itself fails.

What’s next

Workflows

Chain webhook events into multi-step automations.

Multi-tenancy

Scope incoming webhooks per user with ?tenantId= param.

GitHub webhooks

All available GitHub events and payload shapes.

Slack webhooks

All available Slack events and payload shapes.