Live (private)
TypeScript · Netlify Functions · Netlify Blobs · Cal.com · GTM · PostHog · node:test
W3BOPS lead and booking system
Booking webhooks verified and stored in a serverless CRM, with ad conversions that count each booking exactly once.
The problem
A small business site needs to know which ads actually produce booked calls. Counting a conversion when the confirmation page loads overcounts (refreshes, bookmarks, shared links), webhooks can arrive twice or fail without a retry, and the lead record has to survive all of it without a database bill.
Key decisions
- Count a booking only after the server confirms it, once
- The browser carries a random 128-bit ticket into the booking. The confirmation page asks the server to claim it; a create-if-absent write means the first request gets "confirmed" and every later one gets "counted". Only then does GTM fire the Google Ads and Meta tags.
- Verify the webhook before parsing it
- HMAC-SHA256 over the raw body, compared in constant time, with short or default secrets rejected. Each delivery gets a receipt keyed by a hash of the body, so a duplicate is acknowledged and a previously failed one is safely reprocessed.
- Store hashes, not secrets
- Tickets are treated like passwords and only their SHA-256 is kept; emails and booking IDs are hashed before they become storage keys, so reading the store can't redeem a conversion.
- Netlify Blobs with conditional writes instead of a database
- ETag-conditional and create-if-absent writes give the consistency the pipeline needs, and each environment (production, previews, local) gets its own store so a preview can never write real leads.
- Never overcount; document the undercounts
- Cal.com doesn't resend failed booking webhooks, so a failure emails the owner instead of being silently lost. A shared booking reference lets the ad platforms de-duplicate against offline imports.
What I built
- The booking embed and confirmation flow, the signed-webhook function, the booking-chain model (reschedules grouped into one chain, linked to a lead by metadata, then email).
- The CRM record and pipeline CLI on Netlify Blobs, plus PostHog server events and an offline-conversion CSV export for Google Ads.
- The analytics layer: GTM tags gated on the server's confirmation, with consent and Do Not Track respected.
Verification
- 723 unit tests across 108 suites (Node's built-in test runner), plus a local mock-webhook check of the lead function.
- Automated QA across 8,875 generated pages: zero broken internal links out of 468,872, with page facts re-checked.
- Manual Playwright passes at desktop and mobile widths, and Lighthouse runs.
Links
Private repository: happy to walk through the code in an interview.