The canonical lead flow
When a customer submits a quote form on any glass marketing site, this — and only this — happens:
flowchart TD FORM[Customer submits quote form] --> FN["/api/notify Cloudflare Function<br/>runs on the site itself"] FN --> EMAIL[Email to the shop inbox<br/>sent via Resend] FN --> PC[Podium contact created<br/>status: new lead] FN --> PT["Podium welcome text<br/>uses FIRST name only"] FORM -->|Webhook, upsert by lead_id| DB[Lead stored in the sales dashboard] EMAIL --> TEAM[Team follows up] PT --> TEAMThe rules (locked with the owner)
Section titled “The rules (locked with the owner)”- There is NO Slack anywhere in this flow. Alerts are email + Podium, period. The dashboard’s Slack hook is a deliberate no-op — don’t design anything around Slack.
- Name is always ONE line (“First Last”) in every payload — even when the form UI has
separate First/Last fields, the payload sends a combined
name. - The Podium welcome text uses the first name only (
notify.jssplits the combined name). - Alerts vs storage are separate jobs: alerts = the site’s
/api/notifyFunction (Resend email + Podium); storage = the dashboard webhook. Neither depends on the other. - Zapier is retired. The sites went through a Zapier → notify cutover; the
notify.enabledflag keeps a reversible fallback path, but the target state is notify-only.
Single-step vs two-step forms
Section titled “Single-step vs two-step forms”- BCB sites (SFV, Scottsdale, Bellevue, Del Mar, AGLA): single-step form with one “Full Name” field. One submit fires the whole flow above.
- XPRO sites (Walnut Creek, Gateway, A Plus): two-step form — intentionally different, do not collapse it. See two-step forms for the partial/complete logic.
Where the pieces live
Section titled “Where the pieces live”| Piece | Where |
|---|---|
| Quote form | QuoteForm.astro component in each site repo (config from site.ts) |
| Notify Function | functions/api/notify.js in each site repo |
| Resend + Podium credentials | Cloudflare Pages env vars, per project |
| Lead storage endpoint | Sales dashboard web-lead webhook (origin-allowlisted) |
Gotchas that have bitten us
Section titled “Gotchas that have bitten us”- Cloudflare env vars only bind on a NEW deployment. Setting/changing a Pages env var does nothing until you redeploy (an empty commit works). If notify “silently does nothing,” check this first.
- Origin allowlist lives in TWO places on the dashboard side: the config default and
the prod
.envoverride. Editing only the config is a silent no-op if the env var is set. - Stale Podium tokens per CF project: each Pages project carries its own Podium token. A token minted before a scope fix will 403 on contact creation while the welcome text still sends. Fix: copy the current refresh token + client credentials from a working project, remove any static access-token override, redeploy.