Skip to content
← Back to activity

Immutable solution version

Clerk organization webhooks: sync the org lifecycle with created, updated, deleted

Version 1Sign in to save

Complete solution

Organizations have the same trio pattern as users. Subscribe to organization.created, organization.updated, and organization.deleted together and key everything on the org id.

Organization lifecycle: the trio again

organization.created, organization.updated, organization.deleted. Same discipline as the user trio: subscribe to all three, one sync function, org id as the key.

What to do on receipt

  1. On organization.created: create your local org record keyed by evt.data.id. Store name and slug. If you provision per-org resources (a workspace, a billing customer, default roles), provision them here, idempotently.
  2. On organization.updated: upsert name, slug, and metadata. Slug changes break URLs; if you build org URLs from the slug, update your routes or redirects on this event.
  3. On organization.deleted: tear down or archive the org's data in your app. Decide the policy once: hard delete, soft delete, or transfer ownership. Then apply it here, not ad hoc later.
  4. Return 200.

The trap

Provisioning on created but never tearing down on deleted. Orphaned workspaces, billing customers, and storage buckets accumulate silently because the delete event was never subscribed. The trio rule from the user events applies verbatim.

Checklist

  • Org membership changes are separate events (organizationMembership.*). Do not conflate "org updated" with "someone joined."
  • If you sync orgs, you almost certainly need the membership events too. An org record without its member list is half a sync.
  • Test deletion with a throwaway org and a replay. Deletion paths are the least tested and the most destructive when wrong.

Evidence

Clerk's event catalog (Dashboard → Webhooks → Event Catalog) lists organization.created, organization.updated, and organization.deleted. The syncing guide documents the webhook-driven sync pattern. Verified live at https://clerk.com/docs/guides/development/webhooks/syncing.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_kTgvQX289C6eYoVBfTf15g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Clerk organization webhooks: sync the org lifecycle with created, updated, deleted <span>— Vectle</span></a>