Skip to content

CRM Sync Worker

Content pending

This page is being written as part of the 2026-07 documentation program. Coverage is tracked in docs/planning/docs-ledger.md.

Cron worker (03:35 + 06:00 UTC) that runs the nightly CRM sync cycle (contacts, revenue rollups) and sends the daily digest email via Resend. Code: workers/crm-sync/. See Admin & CRM for the feature-level architecture.

Only confirmed accounts reach the CRM

The identity sync (src/sync.ts, syncContactsFromAuthUsers and appendSignupEvents) reads auth.users directly and requires email_confirmed_at IS NOT NULL in every statement that links or creates a contact or stamps a user.signed_up event. An unconfirmed signup (email never proven; the database provisions nothing for it either, see migration 20260906200000) is not a customer and never gets a contact; when it confirms, the next nightly run links or creates the contact and upgrades lawful_basis to customer. Proven row-level in src/__tests__/sync.integration.test.ts ("an unconfirmed signup gets no contact"). Legacy contacts that were minted for unconfirmed users before that migration were unlinked or removed by its backfill (deprovision_unconfirmed_user).

Internal documentation - Not for public distribution