Acme Marketing Architecture

Dynamic — HubSpot webhook nudge and the polling guarantee

Dynamic — HubSpot webhook nudge and the polling guarantee

Diagram type: Dynamic (C4 supporting diagram) Scope: one HubSpot contact change arriving by webhook, then the scheduled 15-minute poll landing the same object again. Audience: data engineers; reviewers checking the "push accelerates, poll guarantees" principle. Structurizr view: Dynamic-WebhookAndPoll in structurizr/workspace.dsl Branches (retries, failure cases) are in the UML sequence sequence-hubspot-webhook-and-poll.md.

Overview

Steps 1 to 6 are the accelerator: the webhook carries an id and a property name, the receiver acknowledges immediately, the nudge worker fetches the record within about a minute and the Bronze loader promotes it through the gate. Steps 7 to 12 are the guarantee: the orchestrator polls HubSpot on hs_lastmodifieddate every 15 minutes regardless of webhooks, lands the same object again, promotes it through the same gate, and only then advances the watermark. Bronze dedupes the two copies on version and payload hash; Silver's MERGE is a no-op for the second one.

Diagram

C4Dynamic
    title Dynamic diagram - HubSpot webhook nudge then polling guarantee
    System_Ext(hs, "HubSpot", "CRM v3 API; webhooks")
    Container(fnhs, "HubSpot adapter", "Azure Functions, .NET 10")
    ContainerQueue(sb, "Service Bus", "ingest-nudges queue")
    ContainerDb(bronze, "lh_bronze", "Fabric Lakehouse")
    Container(loader, "Bronze loader", "Fabric notebook; the gate")
    Container(orch, "Orchestrator", "Fabric pipelines")
    ContainerDb(silver, "lh_silver and control", "Fabric Lakehouse")

    Rel(hs, fnhs, "POST contact.propertyChange (objectId, property); signature validated; 200 returned", "HTTPS")
    Rel(fnhs, sb, "Enqueue the mapped object, objectId, occurredAt, subscriptionType and portalId on ingest-nudges", "AMQP")
    Rel(sb, fnhs, "Deliver batch of nudged ids to the nudge worker", "AMQP")
    Rel(fnhs, hs, "Batch-read current records (100 ids per call)", "HTTPS")
    Rel(fnhs, bronze, "Land nudged records as files with op=webhook_nudge", "OneLake API")
    Rel(orch, loader, "Promote through the gate: classify, scan, tokenise, rewrite, dedupe, provenance", "notebook activity")
    Rel(orch, silver, "Read watermark and api_budget for the Tier 1 schedule", "Delta")
    Rel(orch, fnhs, "extract_incremental(contacts, watermark to now minus 5 minutes)", "HTTPS")
    Rel(fnhs, hs, "Count for reconciliation; page by keyset on hs_object_id inside the window, 200 per page", "HTTPS")
    Rel(fnhs, bronze, "Land pages and manifest (rows, cursor_end, truncated=false)", "OneLake API")
    Rel(orch, loader, "Promote the window through the gate", "notebook activity")
    Rel(orch, silver, "Mark run landed; advance watermark to window_end", "Delta")

Legend

Elements

Element Type Technology Responsibility in this flow
HubSpot External system SaaS Sends the webhook; answers batch reads and searches
HubSpot adapter Container Azure Functions, .NET 10 Receiver, nudge worker and incremental extractor
Service Bus ContainerQueue Azure Service Bus Buffers nudges
lh_bronze ContainerDb Fabric Lakehouse Receives landing files from both paths; Bronze tables
Bronze loader Container Fabric notebook The anonymisation gate; dedupe; provenance
Orchestrator Container Fabric pipelines Runs the Tier 1 schedule; marks the run landed
lh_silver and control ContainerDb Fabric Lakehouse Watermark, budget, run ledger

Key relationships

Step From To Intent Protocol
1 HubSpot Adapter Webhook with id and property HTTPS, signed JSON
2 Adapter Service Bus Enqueue nudge AMQP
3 Service Bus Adapter Deliver nudge batch AMQP
4 Adapter HubSpot Batch-read records HTTPS
5 Adapter lh_bronze Land nudged records as files OneLake API
6 Orchestrator Bronze loader Promote through the gate Notebook activity
7 Orchestrator Control Read watermark and budget Delta
8 Orchestrator Adapter Invoke incremental extract HTTPS
9 Adapter HubSpot Count, keyset page HTTPS
10 Adapter lh_bronze Land pages and manifest OneLake API
11 Orchestrator Bronze loader Promote the window through the gate Notebook activity
12 Orchestrator Control Mark landed; advance watermark Delta

Notable architectural decisions

Assumptions