Webhooks
POST /api/webhooks/clerkAn optional Clerk webhook that keeps users and organizations in sync in the background.
Setup
- In the Clerk dashboard, add a webhook endpoint pointing at
/api/webhooks/clerk, subscribed touser.*andorganization.*events. - 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
| Event | Effect |
|---|---|
user.created, user.updated | Upsert the local user record. |
user.deleted | Remove the local user record. |
organization.created, organization.updated | Upsert the local organization (tenant). |
organization.deleted | Delete the org and cascade to its projects, issues, and events. |