Acme Marketing Architecture

Integration Contracts

Integration Contracts

Mutable document: endpoints, keys, limits and quirks per source, and the outbound event contract. Facts marked verify were taken from vendor documentation or community sources during design and must be re-checked against current vendor documentation before build.

Salesforce

Aspect Contract
Objects (initial) Lead, Contact, Account, Opportunity, OpportunityHistory, Campaign, CampaignMember, User, Task, Event
Auth Dedicated integration user with a read-only permission set; two paths (ADR 10): organisational-account consent held in the Fabric connection for the copy activity, and a Connected App with the JWT bearer flow for the coded paths (reconciliation counts, CDC consumer); the "API Only User" permission is not set
Historical Bulk API 2.0 query jobs per object; chunk by CreatedDate year or by PK chunking; query jobs do not consume the batch allocation (verify)
Incremental key SystemModstamp (not LastModifiedDate, which misses system updates)
Safety lag Window end = now − 2 minutes, to avoid clock skew and in-flight commits
Deletes Daily queryAll with IsDeleted = true for the trailing 15 days (recycle-bin window, verify); CDC emits delete and undelete events
Push (phase 2) Pub/Sub API, /data/<Object>ChangeEvent channels; events retained 72 hours; replay id persisted after each landed batch; gap events logged
Limits Daily API requests: edition base plus per-licence allocation, rolling 24 h (verify figures for the org's edition); CDC delivery allocation may require an add-on; check /services/data/vXX.X/limits at run start
Fabric connector Salesforce objects connector: copy job (full, append, upsert), copy activity, Dataflow Gen2. Authentication is organisational account only (interactive consent held in the Fabric connection); no JWT bearer or client-credentials flow. We use the copy activity to Lakehouse Files with a pipeline-managed SystemModstamp watermark so that Salesforce goes through the Bronze loader like every other source
Quirks Formula fields and some compound fields are excluded from CDC; CampaignMember deletes are common; Person Accounts if enabled

HubSpot

Aspect Contract
Objects (initial) contacts, companies, deals, tickets (optional), owners, marketing emails, email events, forms and submissions, lists, campaigns, engagements (notes, calls, emails, meetings)
Auth Standalone private app (webhooks require standalone, not project-based); read scopes only; token in Key Vault
Historical GET /crm/v3/objects/{type}?limit=100&after= (list, not capped); the property list rides on the URL only while it stays under about 2,000 characters, otherwise list ids and batch-read properties in chunks of 100 (finding C33; HubSpot's URL limit to verify); async CRM export for very large portals; archived=true for soft-deleted objects (visible for a limited period, verify)
Incremental POST /crm/v3/objects/{type}/search with hs_lastmodifieddate GTE window_start AND LT window_end AND hs_object_id GT last_id, one sort rule (hs_object_id ascending; HubSpot accepts a single sort), limit 200, no after: keyset paging, so each request is a fresh query that never pages past the 10,000 cap, and a record modified mid-run cannot shift the next page; the cursor is the last id; request body at most 3,000 characters; one count query per window (limit 1, read total) for reconciliation and logging only; the search index lags writes by moments, which the safety lag covers; object_registry.paging_mode keeps the offset mode selectable; verify hs_object_id GT on the live portal before launch (WP0b finding C2)
Safety lag Window end = now − 5 minutes (search-index lag, PoC brief §4); per object in object_registry.safety_lag_minutes
State fetch POST /crm/v3/objects/{type}/batch/read with up to 100 ids and an explicit property list, for nudged ids and for incremental pages whose property list does not fit the 3,000-character search body (otherwise the search returns the properties and the batch read is skipped)
Associations Search and batch read return no associations; read them with the associations v4 batch read (POST /crm/v4/associations/{from}/{to}/batch/read, up to 1,000 ids per call, every association of each id with typeId, category, label); landed verbatim, one line per from result with its nested to[], as associations_{from}_{to} per run and flattened in the Bronze loader or the Silver mapping (finding C20); HubSpot now publishes this API under a date version (/crm/associations/2026-09/...), so the client pins the version
Deletes Daily archived sweep; webhook *.deletion and *.privacyDeletion as nudges; privacy deletions trigger the erasure runbook check
Push Private-app webhook subscriptions: contact.propertyChange (selected properties), contact.creation, contact.deletion, deal.propertyChange, deal.creation, company.propertyChange; up to 1,000 subscriptions per app; v3 signature (X-HubSpot-Signature-v3 with timestamp); payload carries subscriptionType, objectTypeId, objectId, propertyName, propertyValue, occurredAt, not the record; the receiver maps subscriptionType and objectTypeId to the registry object through object_registry.webhook_object_type and validates the v3 signature against the configured public URL, since API Management rewrites the one the Function sees (finding C24); it enqueues {object, objectId, occurredAt, subscriptionType, portalId} and drops and counts unmapped events (finding C29); HubSpot retries failed deliveries (reportedly up to 10 attempts over 24 hours, verify)
Limits Private app burst, per app: 100 per 10 s (Free/Starter), 190 per 10 s (Professional/Enterprise), 250 with the API limit increase (one HubSpot page still says 200). Daily, per account and shared by all apps on it: 250k / 625k / 1M by tier, +1M per limit increase (at most two), reset at the portal's midnight. Search: 5 requests per second per account, documented as outside the general limit; until the test portal confirms it, adapters charge a search to both the search and the general bucket (finding C27). Associations API: 100 per 10 s (Free/Starter), 150 per 10 s (Professional/Enterprise), 200 with the increase; 500k per day. Headers X-HubSpot-RateLimit-* report the remaining allowance; GET /account-info/v3/api-usage/daily/private-apps reports daily use per private app. Verified against HubSpot docs on 2026-10-26; shares per caller in ADR 8
Quirks Property history requires propertiesWithHistory; email events are a separate, high-volume API; time zone of the portal matters for date-only properties; archived objects never appear in search results, so the archived sweep uses the list endpoint with archived=true
Aspect Contract
Accounts Manager account (MCC); enumerate customer clients via customer_client; login-customer-id header = manager id
Auth OAuth 2.0 refresh token for a dedicated Google account with Read only access on the manager account, plus the client id and secret of the Google Cloud project that holds the API access level (developer tokens were sunset on 2026-09-09). Access level: Explorer (2,880 operations per day on production, automated approval) for PoCs; Basic (15,000 per day, brand verification) for production; Standard (unlimited, manual audit, about 10 business days) only if a day exceeds 15,000 operations. Verified 2026-10-26
Entities (daily snapshot) customer, campaign, campaign_budget, ad_group, ad_group_ad, ad_group_criterion (keywords), conversion_action; diff against previous snapshot in Silver for SCD2
Performance (trailing windows) GAQL via GoogleAdsService.SearchStream on campaign, ad_group, keyword_view, geographic_view, conversion_action segmented by segments.date (and segments.device, segments.conversion_action where used); daily pull of trailing 30 days; weekly pull of trailing 90 days; optional intraday pull of today every 2–4 hours
Operational changes change_event hourly: date range within the past 30 days, LIMIT 10000, paged by change_date_time, which is interpreted in the customer's own time zone (customer.time_zone, read at enumeration); the adapter halves a truncated window inside the run, down to min_window_seconds, and each halving level costs one extra operation (findings C26, C36); may not include every change visible in the UI
Restatement Performance and conversion metrics change after the fact (conversion lag, adjustments); Gold partitions for re-pulled dates are overwritten; metrics.restated business event when a closed day moves beyond tolerance
Limits Daily operation quota per Google Cloud project access level, measured on a sliding 24-hour window; one Search or SearchStream request counts as one operation regardless of rows, pages with a valid next_page_token are free, rejected requests still count; 64 MB per response; RESOURCE_EXHAUSTED for the daily quota (gRPC 8, HTTP 429), RESOURCE_TEMPORARILY_EXHAUSTED for short-term limits with exponential backoff and jitter; serialise per customer account. Verified 2026-10-26
Quirks Money in micros; the customer's own time zone (customer.time_zone) for segments.date; removed entities still appear in historical reports; API versions are retired on a fixed cadence, pin and upgrade quarterly

Landing file layout

Files/landing/{source}/{object}/[customer={id}/]{yyyy}/{MM}/{dd}/{run_id}/
                       customer segment for multi-account sources (Google Ads); yyyy/MM/dd is the UTC date of the window start, not a business date
    manifest.json      {run_id, window_key, pages, rows, cursor_end, truncated, extracted_at, api_version} (also carries requests_used, the windows used, the properties requested, op, property_path and paging_mode)
    page-00001.jsonl   one record per line, verbatim as returned by the API
    page-00002.jsonl

Outbound event contract (data-changed topic)

{
  "schema_version": "1.0",
  "event_id": "sha256(event_type|subject_key|source_version|rule_version)",
  "event_type": "lead.qualified",
  "subject": { "type": "person", "key": "<person_key token>" },
  "occurred_at": "2026-10-26T07:03:12Z",
  "observed_at": "2026-10-26T07:15:40Z",
  "source": "hubspot",
  "commit": { "table": "gold.business_event", "version": 1842 },
  "data": { "lifecycle_stage": { "from": "lead", "to": "marketingqualifiedlead" } },
  "rule_version": "2026.10"
}

Webhook delivery contract

Header Value
X-Acme-Event-Id event_id (idempotency key)
X-Acme-Timestamp Unix seconds
X-Acme-Signature v1=HMAC-SHA256(secret, timestamp + "." + body)
Content-Type application/json

Retry: 2xx = delivered; 429/5xx/timeouts retried with exponential backoff (1 min → 24 h, 8 attempts) then dead-lettered; 4xx other than 429 dead-lettered immediately. Subscribers must treat duplicates as no-ops.

Server-Sent Events contract

GET /events?types=lead.qualified,deal.stage_changed → text/event-stream; id = event_id; event = event_type; data = the JSON above. Reconnect with Last-Event-ID replays from the bus-backed buffer (bounded, best effort). Authentication by Entra ID bearer token.