Overview
Service businesses book clients in one system and market to them from another. A clinic books in its practice management system, while its follow-ups, pipelines and ad tracking run in a CRM such as GoHighLevel. I explored a subscription product that would move booking data between the two and, more importantly, prove that it had: every booking accounted for, anything missing found and replayed, and someone alerted when the connection broke.
Over two weeks I designed and tested the core of that product, verified the data and access model against a live system, analysed 218 integration job posts, and assessed two alternative platforms. Then I parked it, because the evidence said it was not yet worth building. This case study covers both the engineering and the decision.
The Problem
In client work I had seen the same failure repeatedly: a booking-to-CRM connection stops, and nobody notices. On one multi-location health clinic, a deleted staff login stopped a third-party connector for days. Follow-ups did not go out, pipelines were wrong, and the backlog took time to recover.
Existing options (specialist connectors, Zapier or Make, custom builds, manual exports) mostly sell the connection itself. None made it easy to answer a simple question: is the data in the CRM complete and correct right now?
Investigation
What the data really looks like. I worked from real webhook payloads (test records only) rather than documentation. That surfaced behaviour the design had to respect:
- The source sends a patient's entire appointment history on every change, so "new data" cannot be assumed from a delivery.
- A reschedule keeps the original booking's ID and moves it, then creates a separate record for the old slot. Treated naively, that record looks like a brand new booking.
- "Booked" can remain on past, paid appointments, so status alone does not mean "upcoming".
- A course of treatment is several separate bookings, so "new booking" logic fires six times unless bookings are grouped.
Access routes. I compared the platform's partner programme (approval only), staff-account access (workable, but in conflict with the platform's terms of use), and two alternative booking platforms with open APIs. Both alternatives deliver webhooks at least once, out of order, and can stop delivering without notice, which confirmed the reliability problem was real.
Demand. I scored 218 integration job posts. The CRM side was clear, with GoHighLevel dominating. Booking platforms were fragmented, budgets were low, and "I have no connection" outnumbered "my connection is unreliable" by more than two to one.
The Solution
A platform-agnostic core with thin adapters on each side, specified as a typed contract with 20 automated tests:
- Strict validation at the boundary. Every adapter's output passes a strict schema. Unexpected fields such as dates of birth or clinical notes fail validation instead of being stored.
- Revisions, not fingerprints, as delivery keys. A content hash detects change, and each accepted change gets its own revision number.
- One CRM record per booking. Contact-level fields are calculated from all of a client's bookings, so three bookings never overwrite each other.
- Episodes. Bookings are classified as consultation or treatment and grouped with a configurable gap per service, so milestones fire once per course, not once per session.
- Milestones in their own ledger. "New consultation", "course start" and "attended" are keyed so retries, backfills and repairs never fire them twice.
- Reconciliation and repair. Scheduled checks compare source, log and CRM, read back actual CRM values, and repair drift, including records previously marked as synced.
- Consent that only tightens. Opt-outs set restrictions in the CRM, and the connector never lifts one.
The two ideas that mattered most, as a short runnable example. A booking moved from 10:00 to 11:00 and back again ends with the same fingerprint it started with, so the revision number is what makes it three deliveries instead of one.
revisions.pydef fingerprint(booking: dict) -> str:
stable = {k: v for k, v in booking.items() if k not in VOLATILE}
return hashlib.sha256(json.dumps(stable, sort_keys=True).encode()).hexdigest()
@dataclass
class Head:
revision: int
fingerprint: str
def accept(head: Head | None, booking: dict) -> Head | None:
"""Return the new head if this observation is a real change, else None."""
fp = fingerprint(booking)
if head is None:
return Head(1, fp)
if fp == head.fingerprint:
return None # identical resend: no new revision
return Head(head.revision + 1, fp)
def delivery_key(destination: str, booking_id: str, head: Head) -> str:
return f"{destination}:{booking_id}:r{head.revision}"episodes.pydef assign_episodes(bookings: list[dict], gap_days: dict[str, int], default_gap: int = 180) -> list[Episode]:
"""Group active bookings into episodes, independent of arrival order."""
active = [b for b in bookings if b["status"] in ("booked", "arrived")]
active.sort(key=lambda b: (b["starts_at"], b["id"]))
episodes: list[Episode] = []
last_start: dict[str, datetime] = {}
current: dict[str, Episode] = {}
for b in active:
group = f'{b["client"]}:{b["service"]}:{b["kind"]}'
gap = timedelta(days=gap_days.get(f'{b["service"]}:{b["kind"]}', default_gap))
start = datetime.fromisoformat(b["starts_at"])
if group not in current or start - last_start[group] > gap:
current[group] = Episode(group)
episodes.append(current[group])
current[group].booking_ids.append(b["id"])
last_start[group] = start
return episodesEngineering Trade-offs
Make delivery safe to repeat, and never claim more certainty than the system has.
At-least-once delivery, made safe. Exactly-once is only claimed for actions known to be safe to repeat. Anything else that times out is marked "outcome unknown" for a person to decide, rather than retried blindly.
Ordering enforced by the core, not the queue. Queues do not guarantee order, so job claims, per-booking leases and revision checks reject stale work.
Determinism over convenience. Episode assignment is recomputed from full history in start-time order, so live processing, backfill and repair always agree.
Challenges
- A design flaw caught in review. The first version of the contract keyed delivery on content. A review exposed that a booking moved and then moved back would be silently skipped. Moving to revision-based keys fixed that and simplified repair.
- The terms mattered more than the code. Reading the platform's terms of use changed the risk picture more than any technical finding.
Outcome
A tested core contract, a documented data model, and a clear, evidence-based decision: park the product. The technical route worked; the commercial case (a fragmented source market, low budgets, and a reliability pain that buyers rank below simply having a connection) did not justify building it alongside existing work.
Reflection
The most valuable step was checking assumptions against real data and real terms before writing production code. Several design decisions only existed because a payload or a clause contradicted what I expected. Knowing when to stop is part of the engineering.