Concept demo · fictional HVAC company · nothing is sent

Website lead → priced quote PDF → CRM deal → dispatcher alert, in about 3 seconds

Before: the office manager copied web-form leads into the CRM by hand and emailed quotes the next morning. Now one serverless function does it on submit, with $0 middleware fees. Fill the form and watch each step run.

Website form

What the homeowner sees on northwindhvac.example

⚡
1. Webhook receivedCloudflare Worker validates and de-duplicates the lead
waiting
🧮
2. Price calculatedTonnage from sq ft, price book, Phoenix-area labor rate
waiting
📄
3. Quote PDF generatedBranded 1-page quote, stored in Google Drive
waiting
🗂️
4. CRM contact + deal createdHubSpot API: contact, deal, quote attached
waiting
🔔
5. Dispatcher alerted, customer emailedSlack message + email with the PDF
waiting

Run log

Every run is logged. On any failure the owner gets an email with the lead data, so no lead is lost.

Waiting for a form submission…

Why not just use Zapier?

Same result, different running cost.

No-code (Zapier / Make)This build
Monthly feePaid multi-step plan, grows with lead volume$0 (free tier, 100k requests/day)
Custom pricing logicWorkarounds, formatter stepsPlain code, easy to edit
Branded PDF quoteExtra paid appIncluded
Error alertsBasicEmail + Slack with full payload
OwnershipLives in a vendor accountCode in the client's own accounts
export default {
  async fetch(req, env) {
    const lead = await req.json();
    try {
      if (await isDuplicate(env.KV, lead.email)) return ok('duplicate');
      const quote = priceJob(lead);                 // pricing.js
      const pdfUrl = await makePdf(env, lead, quote);   // Apps Script web app → Drive
      const deal = await hubspot(env).createDeal(lead, quote, pdfUrl);
      await Promise.all([
        slack(env.SLACK_URL, `New ${lead.service} lead: ${lead.name}, ${quote.range}`),
        email(lead.email, 'Your Northwind HVAC quote', pdfUrl),
      ]);
      return ok(deal.id);
    } catch (err) {
      await alertOwner(env, err, lead);   // owner gets the raw lead, nothing is lost
      return ok('queued');
    }
  }
};
const PRICE_BOOK = {            // owner edits these numbers, nothing else
  ac:   { perTon: [1650, 2100], base: 2900 },
  hp:   { perTon: [2100, 2700], base: 3400 },
  furn: { perTon: [ 900, 1250], base: 2600 },
  tune: { flat:   [ 129,  189] },
};
export function priceJob({ service, sqft, urgency }) {
  const tons = Math.min(5, Math.max(1.5, Math.round(sqft / 500 * 2) / 2));
  const p = PRICE_BOOK[service];
  let [lo, hi] = p.flat ?? p.perTon.map(r => p.base + r * tons);
  if (urgency === 'now') { lo += 150; hi += 250; }   // same-day crew
  return { tons, lo, hi, range: `$${lo}–$${hi}` };
}