Field notes02 of 04
Deal momentum that actually decays
A HubSpot field that showed stalled deals as healthy, rebuilt as a Worker that recomputes on every activity, schedules its own decay and links contacts to new deals in two seconds.
- System
- Deal momentum on Cloudflare Workers
- Industry
- Real Estate & Investment
- Stack
- HubSpot webhooks · HubSpot Automation API · Cloudflare Workers · Durable Objects · JavaScript · Python
Figures show illustrative sample data. Names, companies and values in them are invented.
01
The situation
The client's pipeline marked each deal Advancing, Engaged, Slipping or Cold with a calculated property. HubSpot recalculates a calculated property only when one of its inputs changes, never because time has passed. Activity only moves forward, so momentum rose with every call and never fell when a deal went quiet. A stalled deal read exactly like a healthy one.
The native fix, a workflow that runs every day, needed Data Hub Professional. The portal did not have it.
A second problem sat next to it. A workflow meant to attach a company's contacts to every new deal had run on each deal creation for months and associated nothing, because it compared two record IDs that can never match.
02
What we built
Component 1: Webhook path
Deal creation and last-contacted changes reach a Cloudflare Worker within seconds. It verifies HubSpot's signature, recomputes momentum from the actual calls, emails and replies, and writes the value back.
Component 2: Decay as an appointment
When activity lands, the next change is already known: a deal contacted today starts slipping in exactly 14 days. A Durable Object keeps a table of those due times and one alarm set to the earliest, so each deal changes on time without polling.
Component 3: A daily backstop
Every morning a scheduled run recomputes every deal, rebuilds the schedule and re-arms the alarm if it is missing. A dropped webhook cannot freeze a deal, and on a healthy day the run writes nothing.
Component 4: Contact roster sync
On each new deal the Worker associates every contact of the deal's primary company, including principals whose own primary company is a different LLC. The native workflow's property match could never reach those. Both writers are idempotent, so they run side by side.
Component 5: Workflow repair
The broken association workflow was backed up, rebuilt through the automation API to wait for the primary-company rollup before matching, and read back to confirm the saved revision.
Component 6: An independent audit
A separate Python script recomputes every deal from the raw activity, resolving call outcomes itself, and diffs the result against what the Worker wrote. Any mismatch fails the run.
03Stack
- HubSpot webhooks
- HubSpot Automation API
- Cloudflare Workers
- Durable Objects
- JavaScript
- Python
04
Results
Momentum recomputed on activity, on a timer and every morning, across more than 800 deals.
On its first live run it caught a deal marked Advancing whose last contact was 31 days old.
An audit of 846 deals found 510 missing deal-to-contact links. 105 of them, across 80 deals, were contacts the native workflow could never reach.
Contacts associated to a new deal 2.0 seconds after it is created, measured live.
Webhook delivery measured at 0.4 seconds for a new deal and 4.1 seconds for a logged call.
Two helper properties that existed only to force recalculation were archived.
More field notes
Your system could be the next note.
Bring the part of your business the CRM can't see yet. We'll show you how we build it.