50+ medications. 12 webhook events. 28 questionnaires. Sandbox verified. One sprint.
Ziv Health needed to connect to MD Integrations (MDI) to offer telehealth prescriptions across 8 clinical categories — weight loss, men's health, women's HRT, dermatology, hair loss, erectile dysfunction, longevity, and female hormone therapy. MDI provides the clinical infrastructure: licensed providers, prescription management, and pharmacy fulfillment through MediVera.
But wiring a telehealth pipeline is not a single API call. It means syncing a formulary of 50+ medications, mapping 28 questionnaires to the right clinical categories, creating vouchers at checkout, tracking cases through 5 stages, handling 12 different webhook events, and sending patients real-time shipment notifications. Each piece depends on the others. A missed mapping means a patient gets the wrong questionnaire. A dropped webhook means a prescription ships without notification.
The Ziv team needed the entire pipeline built, tested, and sandbox-verified — and they needed it before the MediVera contract effective date of April 29, 2026.
Built a service that reads MDI's full offering catalog on boot and maps each medication to Ziv Health's internal product IDs. No manual CSV imports. No spreadsheet maintenance. The formulary stays in sync automatically.
When a patient completes checkout on zivhealth.com, the voucher service creates an MDI voucher, links it to the order, and triggers the intake questionnaire. One purchase, one voucher, one intake — no manual handoff.
Built GET /portal/orders with a 5-step visual pipeline: order placed, intake submitted, case under review, prescription written, shipment tracking. Patients see exactly where their order stands at all times.
Admin dashboard showing which MDI offerings are active, which questionnaires are mapped, and which products have gaps. One screen to see the entire formulary coverage at a glance.
Wired MDI's webhook system to receive 12 event types: case created, case updated, prescription written, shipment dispatched, tracking updated, and 7 more. Auth header validation, idempotency checks, and TrackingNotificationService for patient shipment emails. Tested every event via MDI Test Bench.
POST /api/v1/admin/mdi/sandbox-e2e runs an 8-step health check: auth, offerings, patient creation, vouchers, cases, questionnaire IDs, offering IDs, and webhook config. 100/100 tests pass. Behind Cloudflare Zero Trust + proxy-secret.
From the moment a patient adds a medication to their cart to the moment it arrives at their door — every step is tracked, every event is handled, every notification is sent.
MdiOfferingSyncService reads MDI's catalog on boot and maps 50+ medications to Ziv's product IDs. New meds appear automatically.
Patient completes checkout on zivhealth.com. MdiVoucherService creates a voucher linking the order to an MDI case. Consultation fee ($20 async / $30 sync) billed as a separate line item.
28 questionnaires mapped across 8 categories. The patient answers body profile, medical history, allergies, preferences, HIPAA consent, and MDI compliance — all in one conversational flow.
MDI's clinical team reviews the case. Webhook events fire as the case progresses: case_created, case_updated, provider_assigned, consultation_completed.
Provider writes the prescription. MDI dispatches it to MediVera pharmacy (contract signed, DocuSign 5FCA03B0). Webhook: prescription_written, rx_sent_to_pharmacy.
TrackingNotificationService sends patients shipment updates via email. Webhook events: shipment_dispatched, tracking_updated, delivered. The patient portal shows real-time status.
Three Shulam souls were updated to monitor, dispatch, and report on the MDI pipeline. They run autonomously — no manual intervention required.
Monitors the MDI pipeline health: webhook response times, offering sync failures, voucher creation errors. Fires alerts when any step degrades. Runs the sandbox E2E health check on schedule.
Dispatches patient-facing notifications: intake reminders, prescription confirmations, shipment tracking emails. Coordinates with TrackingNotificationService for real-time delivery updates.
Updated with MDI pipeline KPIs: offering coverage %, questionnaire completion rate, and pipeline throughput. Reports weekly on patient acquisition metrics tied to telehealth categories.
The pipeline runs on Ziv Health's Node 22 backend with Express 5, PostgreSQL, and Redis. Every monetary value uses BigInt atomic units (1 USDC = 1,000,000) — no floating-point money anywhere in the pipeline. The consultation fee ($20 async, $30 sync) is stored as 20000000n and 30000000n respectively.
Webhook authentication uses MDI's auth header pattern with constant-time comparison. Every event is idempotent — replaying a webhook produces the same state. The sandbox E2E test verifies all 8 integration points in a single POST request, running behind Cloudflare Zero Trust and proxy-secret middleware.
The patient-facing portal shows a 5-step pipeline tracker: order placed, intake submitted, case under review, prescription written, and shipment tracking. Each step updates in real time as webhook events arrive.
Every medication mapping deepens the integration. Competitors starting from scratch must map all 50+ medications, 28 questionnaires, and 25 offerings before their first prescription ships.
Every case that flows through the pipeline generates data: average time-to-prescription, questionnaire completion rates, provider response times. This data compounds into operational intelligence that new entrants cannot replicate.
12 event types wired, tested, and monitored. Each event triggers downstream actions: notifications, portal updates, analytics. The event graph is the nervous system of the pipeline — rebuilding it takes months.
MediVera contract signed. As more prescriptions flow through, Ziv Health earns volume pricing and priority fulfillment. Each new patient strengthens the pharmacy relationship — a moat that grows with every order.
MDI Pipeline Intelligence is included in every Lighthouse plan. From formulary sync to shipment tracking — fully wired in one sprint.
Apply for Lighthouse →