Webhooks

POST /api/webhooks/clerk

An optional Clerk webhook that keeps users and organizations in sync in the background.

Setup

  1. In the Clerk dashboard, add a webhook endpoint pointing at /api/webhooks/clerk, subscribed to user.* and organization.* events.
  2. Put its signing secret in CLERK_WEBHOOK_SECRET.

Requests are verified with Svix signatures. Without a secret configured, the endpoint is a no-op (returns 200), and Metricly falls back to syncing the signed-in user and active org lazily on each dashboard load.

Events handled

EventEffect
user.created, user.updatedUpsert the local user record.
user.deletedRemove the local user record.
organization.created, organization.updatedUpsert the local organization (tenant).
organization.deletedDelete the org and cascade to its projects, issues, and events.