meta CAPI outcome sync
A scheduled pipeline that reports demo attendance and closed customers back to Meta.
tldr
A pair of idempotent server-side Meta Conversions API jobs that feed demo attendance and paid-customer outcomes back into ad optimization.
the problem
Optimizing only for form fills gives Meta a weak signal. Attendance and payment are later, higher-value outcomes, but they live in different systems and need matching, hashing, and timestamp handling before they can be sent back.
what it is
A scheduled pipeline that reports demo attendance and closed customers back to Meta.
why it is useful
It gives Meta stronger optimization signals than form fills by sending server-side events for people who showed up and paid.
architecture
Two plain Node scripts run sequentially on a Railway cron: one joins form leads to show-ups and sends `CompleteRegistration`; the other joins classified bookings to the onboarding tracker and sends `Subscribe`. Postgres tracking tables make both jobs idempotent.
how it works
- The first job joins lead records to show-up data and prepares CompleteRegistration events.
- The second job matches closed customers to the onboarding tracker and prepares Subscribe events.
- PII is normalized and hashed before requests are sent to Meta CAPI.
- Tracking tables prevent duplicate events, while dry-run mode makes backfills safer.
implementation notes
- Hashes email, phone, first name, and last name according to Meta requirements.
- Matches closed deals by normalized website domain when email is not shared across systems.
- Backfills known customers that the automated domain match misses.
- Caps event timestamps to Meta's accepted seven-day window and supports dry runs.
engineering decisions
- Runs the two event families sequentially to keep the cron behavior predictable.
- Uses domain matching and explicit backfills for customers whose email identity differs across systems.
- Caps timestamps to the accepted event window instead of silently sending stale events.