Built by Junaid Cheema

Building an AI system that reads every touchpoint on a doctor’s CRM timeline before they start prescribing — and tells leadership, automatically, what drove the conversion.


→ Introduction

The client is a German digital therapeutics company. Their entire growth model depends on one thing: getting doctors to prescribe the app. No e-commerce funnel. No SaaS trial. The buyer is a doctor, the account is a medical practice, and the channels include outbound calls, email campaigns, medical congress appearances, and fax.

A doctor doesn’t sign a contract. They issue their first digital prescription — a clinical act — which might happen weeks or months after the first touch. There’s no checkout timestamp. No UTM chain. No off-the-shelf attribution tool that knows what to do with a congress attendance followed by three outbound calls followed by a fax.

The question of why a doctor started prescribing had no reliable answer. Leadership was making channel and budget decisions on instinct and rep opinion.

This build answers the question. Automatically. On every single conversion.

✕ The challenge

HubSpot held years of activity data across thousands of contacts. Calls, emails, fax dispatches, congress attendances, meetings, lead magnet orders — rich data, logged inconsistently, never read at scale.

The problems were layered.

The same event meant different things depending on who logged it. One rep wrote “Call.” Another wrote “Tel.” Another wrote “good conversation, asked about dosing.” A qualitative call — where a doctor starts asking clinical questions, which is a completely different conversion signal from a cold call — only got treated differently if the rep thought to label it that way. Most didn’t.

Last-touch attribution was actively lying. HubSpot’s default gives 100% credit to whatever happened last. In a journey measured in months, across congresses and fax campaigns and six follow-up calls, last touch is almost never the real story. The final check-in call before a doctor prescribes might be incidental. The congress they attended two months earlier might have been the thing that actually changed their mind.

Nothing was being learned. Every conversion was a signal about what works. Those signals were going to waste. The data existed. Nobody was reading it.

Leadership couldn’t tell you whether the October congress was worth the spend. Whether the fax-then-call sequence was actually outperforming cold calls alone. Whether marketing or sales was driving more prescriptions. The answer was in HubSpot. It just wasn’t surfaced.


✓ The solution

An AI pipeline that triggers on every new testing prescriber, reads their full HubSpot timeline, and produces a clear attribution answer — written back to the contact record, and rolled up into a weekly digest for leadership.

The system does four things that couldn’t be done before.

It reads the activities, not just the labels. Before any analysis runs, Claude reads the notes on every logged activity and normalises what it finds. A call logged as “Tel” with notes saying “doctor asked about contraindications and wanted to see the clinical evidence” gets correctly identified as a qualitative clinical conversation — a much stronger conversion signal than a cold outbound call. The model doesn’t rely on reps to label things correctly. It reads what actually happened.

It classifies every prescriber before attributing anything. Not every conversion can be attributed the same way. A doctor who had zero contact with the company in the past nine months and then started prescribing is a completely different case from one who had a qualitative call last week. The system classifies every prescriber first — was there recent engagement, dormant engagement, or no visible engagement at all? — and handles each accordingly. Doctors with no recent activity get checked for referral patterns: is someone else at the same practice already prescribing? If yes, that’s the likely driver. If no, the system generates a hypothesis note based on whatever context does exist.

It weights and attributes touchpoints across the full journey. For contacts with meaningful recent activity, the AI analyses the full timeline and assigns attribution weight to each touchpoint based on what it was, when it happened, and how it fits into the broader pattern of the journey. Recent events carry more weight than old ones. A face-to-face conversation at a congress carries more weight than an email the doctor may never have opened. An inbound reply to a campaign — a doctor choosing to respond — carries more weight than an outbound call that may have gone to voicemail. The model looks for the moment the journey actually moved: the re-engagement after a long silence, the touchpoint that sparked a cascade of follow-up activity, the high-intent signal right before conversion. It classifies each prescriber as either having one clear dominant driver or a genuine multi-touch conversion, and names the channel.

It turns the data into a read leadership can act on. The per-prescriber attribution writes back to the HubSpot contact record. Every conversion is annotated. But the more valuable output is the weekly digest — Claude reads the full month’s conversion data and produces a plain-language channel performance summary that lands in Slack every Monday morning before the first meeting. Which channels are up. Which are down. Which congress drove the most downstream prescriptions. Whether the fax-then-call sequence is converting better than outbound alone. Anomalies that warrant a closer look.

One paragraph. Meeting-ready. No dashboard required.


⚙️ How the pipeline runs

A contact becoming a Testing Prescriber in HubSpot fires the n8n workflow.

  1. Pull. Full contact timeline extracted via HubSpot API — every activity, every note, across the contact and the associated company record, ordered chronologically.
  2. Normalise. Claude reads every raw activity label and its notes. Maps to canonical event types. Detects qualitative conversations from note content. Flags activities logged on the company record but not the contact — the known CRM blind spot that would otherwise cause silent misclassification.
  3. Classify. Determines engagement tier: Engaged (meaningful activity in the last 6 months), Dormant (6–9 months), or Kickstart (nothing in 9 months or ever). Routes each group to the right analysis path.