Consume WorkOS Directory Sync events for user lifecycle management

domain: workos.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In the WorkOS dashboard, configure a webhook endpoint URL under Webhooks; WorkOS will deliver directory sync events as signed HTTP POST requests to this URL.
  2. Alternatively, poll the Events API at GET /events with the event_type filter (e.g., dsync.user.created) and use a cursor-based after parameter to process events in order without missing any.
  3. Handle dsync.user.created by creating or activating the user in your app and associating them with the directory_id and organization_id from the event payload.
  4. Handle dsync.user.updated by diffing the changed attributes in the payload and updating the corresponding user record; pay attention to group membership changes included in the event.
  5. Handle dsync.user.deleted by deprovisioning the user — disable the account or revoke sessions — as this event fires when a user is hard-deleted from the directory.
  6. Respond to webhook deliveries with a 2xx status within your timeout window; WorkOS retries failed deliveries, so implement idempotency keyed on the event id to prevent duplicate provisioning.

Known gotchas

Related routes

Sequence Argo CD resource deployment with sync waves and resource hooks
argo-cd.readthedocs.io · 6 steps · unrated
Sync Pipedrive person and organization data bidirectionally with an external system using Pipedrive's global search and merge endpoints to handle duplicates
pipedrive.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans