Skip to main content
Sanity → Customer.ioIntegration guide

Connecting Sanity to Customer.io

Sanity is a headless content platform, which means like every headless CMS it holds no commercial record and the tracking question lives elsewhere. Customer.io triggers messages from behaviour, which means an event you send is not recorded — it is acted on, usually within seconds, by sending something to a real person. The join between them succeeds or fails on one thing: whether the person identifier you assign reaches the front-end conversion, not a Sanity record before the conversion happens, because Customer.io can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Sanity webhooks into Customer.io: stop edits from resending emails

A Sanity publish webhook usually triggers a Customer.io API-triggered broadcast, so restrict it to the first publish of the relevant document type or check an announced flag. Exclude drafts, give each dataset its own webhook and Customer.io credentials, and project title, URL and image in GROQ. Purchases and sign-ups come from your app or commerce system.

The usual build is a Sanity publish webhook that triggers a Customer.io API-triggered broadcast: new article, new collection, new episode. Customer.io acts on that call within seconds and emails real people, so the webhook's filter is effectively your send rule. A webhook firing on every update resends the announcement each time an editor fixes a typo after publishing. Restrict it to the first publish of the relevant document type, or check a flag on the document that records it was already announced.

Environments cause the other accidents. Sanity keeps drafts as separate documents with a drafts prefix on the ID, and a webhook configured to include drafts can announce something nobody published. A webhook on a staging or development dataset pointed at the production Customer.io workspace emails customers about test content. Give each dataset its own webhook and its own Customer.io credentials.

Customer.io needs the attributes your broadcast template references, so project them in the webhook's GROQ: title, URL, hero image. A missing slug produces an email with a broken link rather than an error. Purchases and sign-ups come from your app or commerce system under the person identifier; Sanity carries no person and should never send behavioural events.

Sanity → Customer.io · what breaks

Why this join usually fails — Sanity → Customer.io

  1. 01

    The person identifier you assign never reaches Sanity

    The front-end application does the routing, the caching and the identifier capture. Single-page navigation is the usual failure and it belongs to the framework rather than to Sanity.

  2. 02

    A headless stack diagnosed at the wrong layer

    Route changes not tracked, identifiers lost between pages — these are front-end framework problems that get filed against the CMS because that is the name everyone knows.

  3. 03

    A test event sending a real email

    Because campaigns evaluate on arrival, there is no safe place to test in production. A malformed purchase event fired during development against a live workspace will send a real order confirmation to a real person, and that cannot be recalled.

  4. 04

    Nothing reconciles afterwards

    Customer.io shows the event and the resulting campaign activity on the person's timeline. Check what the event triggered, not just that it arrived.

Sanity → Customer.io · the fix

What working looks like — Sanity → Customer.io

  • The person identifier you assign on every conversion

  • Conversions arriving in Customer.io

    The event lands on the person, evaluates against every campaign trigger and segment condition, and may send immediately.

  • Reconciled against the source

Sanity → Customer.io · architecture

How Sanity and Customer.io actually connect

  1. 1

    Sanity holds the truth

    Sanity's real-time content APIs make it excellent at what it does and irrelevant to conversion measurement. Establishing that early saves the client money.

  2. 2

    Customer.io needs a click to match

    Customer.io needs the person identifier, the event name and any attributes the campaign conditions reference. An event whose attributes are missing will still trigger a campaign, which may then send a message with an empty placeholder in it.

  3. 3

    The identifier is the bridge

    The person identifier you assign, captured at the visit and carried into the front-end conversion, not a Sanity record.

  4. 4

    The event source decides reliability

    Send from wherever the money is recorded, not from the content layer.

  5. 5

    Deduplication at the destination

    Customer.io does not deduplicate events. A purchase sent twice can enter a workflow twice and send two emails, and unlike a reporting duplicate the customer sees this one.

Sanity → Customer.io · normal or broken

Working vs. broken, side by side — Sanity → Customer.io

Normal, not a fault

  • The person identifier you assign present on the conversion

  • Sent from your commerce or CRM system

  • Deduplicated correctly

    Customer.io does not deduplicate events. A purchase sent twice can enter a workflow twice and send two emails, and unlike a reporting duplicate the customer sees this one.

  • Reconciles with the source

Actually broken

  • The person identifier you assign missing on most records

    The front-end application does the routing, the caching and the identifier capture. Single-page navigation is the usual failure and it belongs to the framework rather than to Sanity.

  • Sent from the browser

    Route changes not tracked, identifiers lost between pages — these are front-end framework problems that get filed against the CMS because that is the name everyone knows.

  • Counted twice, or not at all

    Because campaigns evaluate on arrival, there is no safe place to test in production. A malformed purchase event fired during development against a live workspace will send a real order confirmation to a real person, and that cannot be recalled.

  • Nobody has reconciled it

Sanity → Customer.io · diagnose

Diagnostic order — Sanity → Customer.io

  1. 01

    Count conversions carrying the person identifier you assign

  2. 02

    Follow one real conversion end to end

  3. 03

    Identify the front-end framework, not the CMS

    The routing behaviour that breaks tracking belongs to Next.js, Nuxt or whatever renders the site.

  4. 04

    Confirm which workspace you are writing to before sending anything

    Environment separation is the whole safety mechanism in behaviour-triggered tools, and it is the thing most often skipped.

  5. 05

    Read the match rate, not the success message

    Customer.io shows the event and the resulting campaign activity on the person's timeline. Check what the event triggered, not just that it arrived.

Sanity → Customer.io · prove

How it gets proven — Sanity → Customer.io

Source of truth

Your commerce, CRM or billing system — Sanity has no orders and no customers.

  • The person identifier you assign confirmed present on a live conversion.
  • Events confirmed on person profiles with the triggered campaign activity verified, in a test workspace before production.
  • The conversion confirmed sourced from the commerce system, with front-end routing verified separately.

Sanity → Customer.io · free audit

What we check in the free audit

  • Count conversions carrying the person identifier you assign
  • Follow one real conversion end to end
  • Identify the front-end framework, not the CMS
  • Confirm which workspace you are writing to before sending anything
  • Read the match rate, not the success message

Checked against

Your commerce, CRM or billing system — Sanity has no orders and no customers.

Get my free conversion tracking audit

Free30 minutesNo obligation

Sanity → Customer.io · when not to buy

When you don't need this — Sanity → Customer.io

  • Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the person identifier you assign.
  • There is no Sanity-specific build. Fix the front end and the commerce integration; the CMS is not in the path.
  • If your messaging is scheduled rather than behavioural, a simpler email platform does the job and removes the whole class of accidental-send risk.

Sanity → Customer.io · what we deliver

What gets built — Sanity → Customer.io

  • Identifier capture into Sanity

    Capture and persist the identifier server-side in the front-end application, then carry it into the system that records the sale.

  • Event source: your commerce or CRM system

    Send from wherever the money is recorded, not from the content layer.

  • Dispatch to Customer.io

    The Customer.io Track API, posted server-side from your order or product system with the person identifier and event attributes.

  • Reversals where they exist

    Handled by the commerce system.

Written guarantee

95%+ tracking accuracy

Measured against Your commerce, CRM or billing system — Sanity has no orders and no customers.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Sanity → Customer.io questions, answered

Yes, by calling Customer.io's API-triggered broadcast, usually through a small function in between. Limit it to the first publish, or every edit resends.

Free · 30 min

Get Sanity and Customer.io joined properly

Free30 minutesNo obligation