← All case studies

// engineering

Booking Sync Assurance: Designing a Connector, Then Deciding Not to Build It

TypeScriptzodCloudflare WorkersD1QueuesDurable ObjectsGoHighLevel API

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:

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:

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 episodes

Engineering Trade-offs

The core principle

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

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.