Marketing email dispatch (onset-web)¶
Cloudflare Pages cron must invoke functions/scheduled.js frequently enough to drain
marketing_send_queue (sequence steps + scheduled broadcasts).
Recommended setup (pick one):
Option A — Pages Functions cron (dashboard only; no public API yet)
- Workers & Pages → Pages → onset-web → Settings → Functions
- Add Cron Trigger:
*/5 * * * *(every 5 minutes) targeting the production environment
Option B — Standalone cron Worker (deployed; same cadence)
Cloudflare Worker onset-marketing-dispatch-cron runs */5 * * * * and POSTs to
/api/admin/marketing-dispatch on production. Deploy from
workers/onset-marketing-dispatch-cron/ (wrangler deploy; secret ONSET_ADMIN_ALERTS_TOKEN).
The Pages functions/scheduled.js handler still runs weekly adherence mail on Sunday 19:00 UTC when a Pages cron is configured; marketing dispatch runs on every cron tick (Pages cron or the standalone worker).
Required production secrets (via BWS sync-onset-deploys.sh):
SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEYSENDGRID_API_KEYMARKETING_FROM_EMAIL=updates@theonset.app(optional override)MARKETING_CAN_SPAM_POSTAL(CAN-SPAM postal address)LASTVET_WEB_BASE_URL=https://last.vet(LastVet confirm/unsubscribe links in sequence mail)LASTVET_MARKETING_FROM_EMAIL=updates@last.vetLASTVET_MARKETING_FROM_NAME=LastVet
Dispatch drains marketing_send_queue for both onset and lastvet products each cron tick.
Kit secrets (KIT_*, ONSET_KIT_FORM_ID_01) are removed. Cancel the Kit account and automations manually after cutover.
Legacy hero signups (pre-platform)¶
Hero form signups that previously emailed support@theonset.app (not Kit) can be imported from last1-admin:
Admin → Marketing → Onset → Subscribers → Import legacy
Or POST /api/admin/marketing/onset/subscribers/import-legacy with { "email": "...", "source": "hero-legacy", "enrollWelcome": true }.
Bulk: POST .../import-legacy/bulk with { "emails": "a@x.com\\nb@y.com" }.
Imports mark the row confirmed, apply the hero tag, and enqueue the default welcome sequence (step 0 when cron runs).