Enterprise experience · sanitized reconstruction
HubSpot ↔ Dynamics 365 / Dataverse
Connecting two CRMs starts with identity, ownership and safe failure behavior. A sanitized reconstruction of an enterprise integration originally developed in 2025.
- Python / Flask
- HubSpot APIs
- Dataverse / OData
- Entra ID / OAuth
- Cloud Run
- Scheduler / OIDC
- Cloud Storage
At a glance
- Context
- Enterprise CRM integration originally developed in 2025; public reconstruction with private details removed.
- My role
- Integration design and hands-on implementation.
- Problem
- Synchronize contacts and related opportunities without guessing identity or overwriting ambiguous records.
- Stack
- Python, Flask, HubSpot, Dataverse, Entra ID and Google Cloud.
- Defensible outcome
- Inspectable synchronization patterns, explicit conflicts, no-op detection and incremental reverse contact updates. No published business-impact metric.
01
Context
I developed the original integration in a private enterprise environment in 2025. The public repository is a later, sanitized reconstruction: it preserves integration patterns and technical decisions, with customer data, credentials, proprietary fields and business rules removed. It is not the exact production source.
The forward workflow reads contacts from a HubSpot list and maintains Dataverse contacts and related opportunities. Reverse contact synchronization is an explicit option rather than an assumption that every field should flow in both directions.
02
Challenge
Calling the APIs is the straightforward part. The harder questions are whether two records represent the same person, which system owns a value and what should happen when the evidence is incomplete. Picking the first search result would make the code shorter while making an incorrect write much harder to explain.
03
Constraints
The two systems expose different APIs and identity models. Requests can be rate-limited or fail after a remote side effect has already happened. The reconstruction also needs to remain useful without exposing the original organization’s Dataverse schema. Mapping is therefore configurable and demonstrated with fictional fields.
04
Architecture
A small Python/Flask service is intended for Cloud Run, invoked by Cloud Scheduler using OIDC. It reads HubSpot APIs and accesses the Dataverse Web API through Entra ID client-credentials authentication. Runtime secrets belong outside the repository. The optional reverse path uses Cloud Storage to persist a bounded synchronization checkpoint.
Conceptual view. The service calls both CRMs; Entra ID provides Dataverse access. Cloud Storage stores the reverse-sync checkpoint. This is not a customer infrastructure diagram.
05
Key decisions
Forward matching uses normalized email first and normalized mobile phone as a fallback. Records without either identifier are skipped. Multiple matches become explicit conflicts; the service never chooses an arbitrary record. Opportunity identity combines the matched contact with configured business keys.
Reverse synchronization is deliberately narrower: contacts only, matched by normalized email, updating existing HubSpot records. A missing match is reported rather than automatically creating a contact. Forward mode remains the default.
06
Reliability and safety
Normalized no-op comparisons avoid unnecessary contact writes. Safe reads use bounded retries for transient errors; writes are not blindly replayed after ambiguous failures. Reverse windows exclude integration-user changes, and checkpoints advance only after a successful window. The first reverse run initializes its checkpoint rather than replaying the entire history.
The public project includes synthetic tests and CI covering matching, conflicts, reverse synchronization, checkpoints, retries and endpoint behavior. Structured logs avoid raw contact payloads and credentials. These are reviewable implementation choices, not a claim of exactly-once processing.
07
Outcome
The reconstruction makes the important behavior inspectable: create, update, skip, missing and conflict have different meanings. It demonstrates how I approach an integration that must refuse uncertain writes. I do not attach revenue, savings or reliability percentages to this case because those measures are not published.
08
Tradeoffs / what I would watch
The checkpoint is not a distributed lock, and conflict handling does not invent a latest-update-wins policy. Overlapping or horizontally scaled runs would need a transactional lease or lock. I would also review field ownership, duplicate remediation and operational handling of conflicts before expanding reverse synchronization.
The next step
Let’s make the systems work together.
Tell me where the process breaks, what you use today and what needs to change. We can start with an assessment.
Discuss a project