Per-trade deal budgets
Reads each signed quote, classifies every line by trade and as labor or material, and writes revenue, material and labor budgets to the deal.
Data paths and guards
- HubSpot: Deals with budget fields per trade, calculated profit and cost, and the Contract Signed workflow.
- Budget service: Vercel functions for both apps: webhook and stage triggers, each app’s trade engine and OAuth.
- Config and log: Each portal’s trade rules and property map, and a log of every webhook.
- SumoQuote: Signed proposals with sections, line items and tier-level markups.
- Zuper: Signed estimates and change orders on the deal’s project.
- From SumoQuote to Budget service: Signed-quote webhooks. Each signed proposal, with its sections, line items and markups. A quote is signed in SumoQuote.
- From HubSpot to Budget service: Contract Signed. The deal id, posted by a HubSpot workflow. A deal reaches Contract Signed.
- From Zuper to Budget service: Signed estimate. The signed Zuper estimate for the deal’s project, and its change orders, read through the API. Each Contract Signed post.
- From Budget service to HubSpot: Budgets per trade. Revenue, material and labor budgets for each trade, written to the deal. Each aggregated quote.
- From Budget service to Config and log: Rules and events. The portal’s trade rules and property map, and each raw webhook. Every run.
- On Signed-quote webhooks: Raw payload log. Every webhook’s raw payload is logged, so a disputed total can be replayed through the engine.
- On Signed estimate: Change orders fail closed. A change order whose trade cannot be resolved is surfaced for review, never guessed.
- On Budgets per trade: Clears only its own writes. A backfill clears a value only when property history shows this app wrote it.
- Built by me
- Platforms I connect to
- Guards
- In production
| Signed-quote webhooks Each signed proposal, with its sections, line items and markups |
|---|
| Contract Signed The deal id, posted by a HubSpot workflow |
| Signed estimate The signed Zuper estimate for the deal’s project, and its change orders, read through the API |
| Budgets per trade Revenue, material and labor budgets for each trade, written to the deal |
| Rules and events The portal’s trade rules and property map, and each raw webhook |
-
Systems
Quotes are signed in SumoQuote or Zuper, and deals live in HubSpot. Between them, each app runs as Vercel functions with its own trade engine, keeping trade rules and an event log in Supabase Postgres.
-
Data paths
SumoQuote posts each signed quote by webhook. For Zuper, a HubSpot workflow posts the deal at Contract Signed and the service reads the signed estimate. The engine expands bundles, splits labor from material, finds each line’s trade and writes 3 budgets per trade.
- a Signed-quote webhooks
- b Contract Signed
- c Signed estimate
- d Budgets per trade
- e Rules and events
-
Guards
Every raw webhook is logged, so a total can be replayed. A change order whose trade is unclear is surfaced, not guessed, and backfills clear only the values this app wrote.
- Raw payload log on a
- Change orders fail closed on c
- Clears only its own writes on d
-
Result
Signed quotes become budgets across 11 trades, with 0 collisions across 1,194 catalog products, and the SumoQuote budgets match SumoQuote’s own totals exactly.
What I built
- Two HubSpot apps with Vercel backends: one reads signed SumoQuote quotes from webhooks, the other reads signed Zuper estimates when a deal reaches Contract Signed.
- A trade engine that expands bundles, classifies each line as labor or material and finds its roofing trade by section, name, brand and category.
- 3 budget properties written per trade, across 11 trades in the Zuper version and 10 in the SumoQuote version; HubSpot calculates profit and cost.
- Change orders attributed to a trade by a resolver that fails closed, surfacing unassigned amounts for review instead of guessing.
- Settings pages for trade detection and property mapping, with each portal’s config and an event log in Supabase.
- Backfills that clear only values this app wrote, read from property history, so two other writers on the same fields stay intact.
What the guards protect against
| The risk | The guard |
|---|---|
| A wrong budget cannot be traced or replayed. | Raw payload log Every webhook’s raw payload is logged, so a disputed total can be replayed through the engine. |
| Change-order amounts land on the wrong trade. | Change orders fail closed A change order whose trade cannot be resolved is surfaced for review, never guessed. |
| A cleanup erases values two other integrations wrote. | Clears only its own writes A backfill clears a value only when property history shows this app wrote it. |
Results
- 0 collisions across 1,194 catalog products.
- First real deal: 21 line items, 0 unmapped, 12 properties written.
- SumoQuote budgets match SumoQuote’s own totals exactly: prices are read per unit, and tier-level markups and discounts are spread across their lines.
Facts
- Volume is small: about 5 of 148 Zuper-linked signed deals had a Zuper estimate in July
- A Repairs trade added, which 51 existing tickets fall under
- The SumoQuote version writes 30 properties, and HubSpot derives 20 more by calculation
- 67 checks in the trade engine’s test suite
Related builds
-
Desktop accounting connector
Date: Jun 2026
Fact: Sales recognition reconciled to the cent across 3,709 deals
Client: For a residential roofing and solar contractor
Systems: QuickBooks Desktop
Status: In production
-
QuickBooks job costing
Date: Aug 2026
Fact: On day one of a 3-day hackathon, an invoice posted through the approval gate
Client: For contractors on HubSpot (a hackathon build)
Systems: QuickBooks Online, Stripe and Claude
Status: Active
-
CPQ inside HubSpot
Date: Jul 2026
Fact: Semi-finalist and honorable mention: 166 products, quantities from 134 tokens
Client: For HubSpot’s quote template contest, with a fictional brand
Systems: HubSpot
Status: Active