Webhooks

From joelhooks/joelclaw · View interactive version

Webhooks is an AI agent skill from the GitHub repository joelhooks/joelclaw. Add, debug, and manage webhook providers in the joelclaw webhook gateway. Use when: adding a new webhook integration (GitHub, Stripe, Vercel, etc.), debugging webhook signature failures, checking webhook delivery, testing webhook endpoints, registering webhooks with external services, or reviewing w

How to use this skill

Skill file

Webhook Gateway Operations

For private addresses, accounts, ports, and host roles, see .brain/resources/operator-network-context.svx in the private dark-wizard repo and the tailnet-topology skill. Replace angle-bracket placeholders with the configured values before running commands.

Manage the joelclaw webhook gateway — add providers, debug delivery, register with external services.

Architecture

External Service → hooks.joelclaw.com → narrow Vercel raw-body proxy
  → <central-host> Tailscale Funnel :10000 → Worker :3111 → /webhooks/:provider
  → verifySignature() → normalizePayload() → (queue pilot or direct Inngest event) → notify function → gateway

Stable provider URL target:

https://hooks.joelclaw.com/webhooks/<provider>

The ingress is intentionally narrow: it preserves raw bodies/signature headers and only proxies /webhooks/:provider. Provider registrations still using retired host are migration work; do not declare a provider migrated until a real signed delivery succeeds through the stable URL.

Current Providers

| Provider | Events | Signature | Legacy/current registration until verified migrated |

|----------|--------|-----------|------------|

| todoist | comment.added, task.completed, task.created | HMAC-SHA256 (x-todoist-hmac-sha256) | https://<tailnet-host>/webhooks/todoist |

| front | message.received, message.sent, assignee.changed | HMAC-SHA1 (x-front-signature) | https://<tailnet-host>/webhooks/front |

| vercel | deploy.succeeded, deploy.error, deploy.created, deploy.canceled | HMAC-SHA1 (x-vercel-signature) | https://hooks.joelclaw.com/webhooks/vercel |

| github | workflow_run.completed, package.published | HMAC-SHA256 (x-hub-signature-256) | https://hooks.joelclaw.com/webhooks/github |

Current ADR-0217 pilot note: when QUEUE_PILOTS=github, the webhook gateway enqueues normalized github/workflow_run.completed events into the shared Redis queue instead of posting them directly to Inngest. The Restate drainer then forwards the concrete event name github/workflow_run.completed. github/package.published still goes direct.

Adding a New Provider

See references/new-provider-checklist.md for the full 8-step checklist.

Quick summary:

  1. Create providers/{name}.ts implementing WebhookProvider interface
  2. Register in server.ts provider map
  3. Create Inngest notify function(s) in functions/{name}-notify.ts
  4. Export from functions/index.ts and add to functions/index.host.ts (or index.cluster.ts when cluster-owned)
  5. Store webhook secret in agent-secrets → add lease to start.sh
  6. Deploy: joelclaw inngest restart-worker --register
  7. Register webhook URL with external service
  8. Verify E2E with curl + real webhook

Key Files

| File | Purpose |

|------|---------|

| packages/system-bus/src/webhooks/types.ts | WebhookProvider interface, NormalizedEvent type |

| packages/system-bus/src/webhooks/server.ts | Hono router — dispatches to providers, rate limiting |

| packages/system-bus/src/webhooks/providers/ | Provider implementations (one file per service) |

| packages/system-bus/src/inngest/functions/*-notify.ts | Gateway notification functions per provider |

| packages/system-bus/src/inngest/functions/index.ts | Function exports barrel |

| packages/system-bus/src/inngest/functions/index.host.ts | Host worker function registration (current active role) |

| packages/system-bus/src/inngest/functions/index.cluster.ts | Cluster worker function registration (future/role split) |

| packages/system-bus/src/serve.ts | Worker role selection + health endpoint + webhook provider list |

| ~/Code/joelhooks/joelclaw/packages/system-bus/start.sh | Secret leasing on host worker startup |

Debugging Webhooks

Check if webhook is arriving

# Watch worker logs
joelclaw logs worker --follow --grep webhook

# Or directly
curl -s http://localhost:3111/ | jq .webhooks
# → { endpoint: "/webhooks/:provider", providers: ["todoist", "front", "vercel"] }

Signature verification failures

# Test with manual HMAC (SHA1 example for Vercel)
SECRET="your-webhook-secret"
BODY='{"type":"test-webhook","payload":{}}'
HMAC=$(echo -n "$BODY" | openssl dgst -sha1 -hmac "$SECRET" -binary | xxd -p)
curl -X POST http://localhost:3111/webhooks/vercel \
  -H "Content-Type: application/json" \
  -H "x-vercel-signature: $HMAC" \
  -d "$BODY"

Common failures:

Check Inngest received events

joelclaw runs --count 5
# Look for vercel-deploy-*, todoist-*, front-* function runs

Gateway not receiving notifications

joelclaw gateway status
joelclaw gateway events   # Peek pending events

Registering Webhooks with Services

Vercel (Pro/Enterprise required)

# Via Vercel dashboard: Settings → Webhooks → Create
# Or via API:
VERCEL_TOKEN="your-api-token"
curl -X POST "https://api.vercel.com/v1/webhooks" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.joelclaw.com/webhooks/vercel",
    "events": ["deployment.created", "deployment.succeeded", "deployment.error", "deployment.canceled"]
  }'

The response includes a secret — store it: secrets add vercel_webhook_secret --value "..."

GitHub

Set up via repo Settings → Webhooks:

Todoist

Configured at https://hooks.joelclaw.com/webhooks/todoist via Todoist App Console → Webhooks tab.

Uses client_secret as HMAC key (not the "Verification token").

Front

Configured at https://hooks.joelclaw.com/webhooks/front as a Front application webhook.

Initial validation is a signed challenge. Application events use HMAC-SHA256 over timestamp:rawBody; legacy Rules events use HMAC-SHA1 over compact JSON. Keep their secrets separate.

Signature Algorithms by Provider

| Provider | Algorithm | Encoding | Header | Secret Source |

|----------|-----------|----------|--------|---------------|

| Todoist | HMAC-SHA256 | base64 | x-todoist-hmac-sha256 | App Console → client_secret |

| Front application | HMAC-SHA256 | base64 over timestamp:rawBody | x-front-signature, x-front-request-timestamp | joelclaw-front-app-secret |

| Front rules | HMAC-SHA1 | base64 over compact JSON | x-front-signature | front_rules_webhook_secret |

| Vercel | HMAC-SHA1 | hex | x-vercel-signature | Webhook creation response |

| GitHub | HMAC-SHA256 | hex (prefixed sha256=) | x-hub-signature-256 | Webhook config secret |

| Stripe | HMAC-SHA256 | hex | stripe-signature (structured) | Endpoint signing secret |

Gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.