Skip to content
Solutions Blueprint

Architecting HIPAA-Compliant Automation for a $50M+ D2C Telehealth Network

Hero featured image

A $50M+ D2C telehealth network couldn't scale compliant patient outreach, so we built a stateless API layer between their custom ERP and HubSpot. It triggers personalized Twilio SMS and Mailgun email sequences for up to 12,000 new leads a month without ever exposing protected health information (PHI) to the CRM.

Executive Summary

context-header-icon

Context

A high-growth Men’s Telemedicine Provider manages over 600,000 patient records across multiple US states. It relied on a custom-built ERP for clinical data and a fragmented mix of Twilio and Mailgun for patient comms. Neither connected to HubSpot in a way that kept protected health information out of the CRM.

what-we-built-header-icon

What We Built

We built a bi-directional API bridge. It uses non-sensitive lifecycle flags to trigger complex, multi-stage patient nurture sequences. PHI stays isolated inside the client’s legacy ERP, while HubSpot orchestrates over 50,000 automated SMS and email touchpoints per month.

tech-stack-header-icon

Tech Stack

  • HubSpot Marketing & Operations Hub Enterprise
  • Custom legacy ERP
  • Twilio SMS API
  • Konnektive Billing
  • Mailgun Email Infrastructure

Not a fit if all patient records already live inside HubSpot rather than a separate clinical system, since the stateless-flag design depends on protected health data staying in an outside system that only passes non-sensitive status updates across. It is also not a fit if that legacy system has no open API for frequent, low-latency triggers, since the flag-passing approach cannot run without one.

the-challenge-header-icon

The Challenge

The clinic was generating 9,000 to 12,000 new leads a month, and the technical stack was failing under that volume. Its homegrown ERP held the master medical records but was not connected to HubSpot in any useful way. A blunt API call had created 160,000+ contacts and labeled every one of them API as the source, which destroyed marketing attribution. The clinic's IT team guarded the legacy codebase closely, so any integration had to augment their architecture rather than replace it.

HIPAA set the tightest constraint. The clinic needed automated patient follow-ups to drive revenue, but moving the medical context those automations would need into HubSpot would have created immediate HIPAA audit exposure the clinic was not yet equipped to manage.

our-approach-header-icon

Our Approach

We changed the design from a data sync to a command sync. Patient medical data never moves into HubSpot. Instead, a set of stateless flags, such as Consultation Booked or Lab Kit Purchased, pushes from the ERP to HubSpot through a custom middleware layer. That keeps protected health information out of the CRM entirely while still driving the automation logic.

We rebuilt the endpoint payloads to capture granular UTM and source data, separating the Facebook and Google leads that had been lumped together before. When a patient reaches a milestone in the clinic, such as completing a medical history form, the ERP pings HubSpot and HubSpot triggers a Twilio SMS workflow. That structure supports 360-day nurture sequences that halt automatically the moment a patient moves to the next clinical stage, and the CRM never receives a patient's diagnosis.

This engagement is part of our systems integration work for healthcare & wellness organisations.

impact-header-icon

Impact

check-icon

20% Increase in Lead-to-Patient Conversion

Automated Twilio SMS touchpoints, triggered by real-time clinical milestones, gave leads the right instructions for lab kits and consultations. No manual intervention was needed.

check-icon

35% Reduction in Manual Operational Tasks

This outreach used to be manual, handled by the call center and clinical staff by hand. Automating it removed hundreds of hours of manual follow-up from the weekly workflow.

check-icon

12% Marketing Budget Reallocation

Fixing the "API" lead source labeling allowed the client to see exactly which channels (Facebook vs. Google) were driving prescription-ready leads, leading to an immediate shift in ad spend toward high-ROI channels.
check-icon

30% Data Error Reduction

Bi-directional syncing now unifies the billing system (Konnektive), the ERP, and HubSpot. Duplicate contact records and misfired automation sequences fell by 30%.

Technical Blueprint
1

We built a custom API endpoint. It accepts only boolean or categorical "readiness" flags from the clinical ERP. HubSpot uses those flags to orchestrate patient care without storing any protected health data, and the compliance boundary stays clean.

2

We integrated Twilio directly into HubSpot workflows using custom code actions. That delivery covers 50,000+ monthly SMS messages, each dynamically personalized using data properties the ERP's API calls update.

3

We overhauled the legacy API integration so it captures multi-channel source data, mapping incoming webhooks to specific HubSpot custom properties to preserve the original lead source. That fixed the "API-only" labeling issue.

4

We mapped a custom 4-stage telemedicine path across HubSpot and the legacy ERP: Lead, Assessment, Lab, Meds. A bi-directional sync watches the clinical system. When a status changes there, it updates the HubSpot deal stage and contact lifecycle instantly, firing the relevant nurture or suppression logic.

API integration architecture bridging HubSpot, a custom ERP, and Twilio for telehealth.

The clinic needed automated follow-ups, but moving a patient's medical context into HubSpot would have created HIPAA audit exposure it wasn't yet equipped to manage. So we changed the design from a data sync to a command sync. The ERP now pushes stateless flags such as "Consultation Booked" or "Lab Kit Purchased" through a custom middleware layer, and the patient's diagnosis never reaches the CRM. HubSpot reads the flag and triggers a Twilio SMS workflow.

FAQ

How do you ensure HIPAA compliance if HubSpot is triggering the messages?

The architecture is built on "data siloing." HubSpot never receives the patient's medical records or specific diagnosis. Instead, it receives a non-sensitive flag (e.g., "Step 2 Complete") which triggers a pre-written, compliant message template. Before any SMS goes out, the workflow re-checks the contact's current clinical milestone, so a patient who has just booked a consultation or bought a lab kit drops out of the sequence instead of getting a reminder for a step they have finished. The clinical ERP remains the single source of truth for PHI, while HubSpot acts as a stateless automation engine.

Can this integration handle high-volume lead spikes?

Yes. The solution was stress-tested against the client's volume of up to 12,000 new leads a month and a database of 600,000+ patient records. By using a middleware layer to gate the API calls and HubSpot's Enterprise-level workflow engine, the system held up through peak campaign periods without recreating the duplicate records the old sync produced.

footerCTA footerCTA-mobile
Spice up your inbox
Sign up for our newsletter
Don't worry - we only average, like, two emojis per subject line.