Acme Marketing Architecture

Sequence: HubSpot webhook nudge and the polling guarantee

Sequence: HubSpot webhook nudge and the polling guarantee

Shows why webhooks are an accelerator and never the truth: the webhook carries only an id and a property name; the polling run every 15 minutes lands the same object again, idempotently, from the search endpoint.

sequenceDiagram
    autonumber
    participant HS as HubSpot
    participant WH as Webhook receiver (Function)
    participant Q as Service Bus queue ingest-nudges
    participant NW as Nudge worker (Function)
    participant ORC as Orchestrator (pipeline)
    participant AD as HubSpot adapter (Function)
    participant B as Bronze
    participant L as Control ledger
    HS->>WH: POST contact.propertyChange (objectId, property)
    WH->>WH: validate v3 signature and timestamp
    WH->>Q: enqueue {object, objectId, occurredAt, subscriptionType, portalId}
    WH-->>HS: 200 OK, fast
    Q->>NW: batch of ids
    NW->>HS: batch/read (100 ids)
    HS-->>NW: current records
    NW->>B: land files (op=webhook_nudge); next loader run promotes
    NW->>L: nudge_log
    Note over ORC,AD: every 15 min (Tier 1) regardless of webhooks
    ORC->>L: read watermark, api_budget
    ORC->>AD: extract_incremental(contacts, [wm, now-5m])
    AD->>HS: search hs_lastmodifieddate in window (count pre-check)
    alt total >= 10000
        AD->>AD: log total for reconciliation
    end
    AD->>HS: search pages (keyset on object id)
    HS-->>AD: ids and properties
    AD->>B: land pages and manifest
    AD-->>ORC: manifest {rows, cursor_end, truncated=false}
    ORC->>L: run landed, watermark = window_end

Failure cases covered

Failure Effect
Webhook never arrives Next poll lands the record; latency rises from ~1 min to ≤ 15 min
Webhook receiver down HubSpot retries; if retries are exhausted, the poll catches it
Search window exceeds 10,000 matches Keyset paging reads past the cap one fresh query at a time; total is logged for reconciliation
Same record landed by nudge and by poll Bronze dedupes on version and hash; Silver MERGE is a no-op
HubSpot 429 Paced limiter pauses; Retry-After honoured; cursor preserved