Back to Alchemy
Alchemy RecipeIntermediateautomation

Healthcare clinic intake form to personalised patient education video pipeline

A patient walks into a clinic, completes an intake form listing their hypertension diagnosis, and leaves with a generic pamphlet they'll probably never read. Two weeks later, they're back with questions that could've been answered by a video tailored specifically to their condition and risk factors. This is the clinic automation problem that costs time, increases readmissions, and leaves patients under-informed. The gap exists because personalisation at scale requires three things: extracting structured data from intake forms, generating custom video content based on that data, and doing it all without anyone manually touching the process between steps. Most clinics still handle this with spreadsheets and stock footage. We're going to fix that. This workflow takes a patient intake form, extracts diagnosis and demographic information via AI scribe, writes a personalised education script, generates a video with a talking avatar, and sends it back to the patient through their preferred channel. No copy-paste, no human bottleneck, no generic materials.

The Automated Workflow

Use n8n for this workflow. It's better than Zapier for healthcare because it supports more complex conditional logic, and better than Make if you need to self-host for compliance. If you must use a cloud solution, Make works fine, but n8n gives you more control over HIPAA-adjacent data handling. Here's the flow: 1. Patient submits intake form via a web form or clinic portal 2. Freed AI extracts structured data (diagnosis, symptoms, medication history, patient name, age) 3. n8n transforms the extracted data into a script prompt 4. Claude Opus 4.6 generates a personalised education script (1,500 words max, grade 6 reading level) 5. HeyGen or Hour One creates a video with a talking avatar narrating the script 6. Video is stored and a link is sent to the patient via email or SMS

Setting up the n8n workflow:

Start with a webhook trigger that receives form submissions. Your clinic portal (or a tool like Formstack) POSTs the intake form data here.

POST /webhook/patient-intake
Content-Type: application/json { "patient_name": "Sarah Chen", "age": 47, "diagnosis": "Type 2 Diabetes", "symptoms": "Increased thirst, fatigue", "medications": "Metformin 500mg twice daily", "form_data": "raw form fields..."
}

Step 1: Freed AI Integration

Freed AI is HIPAA-compliant and designed for healthcare workflows. If your clinic already uses it for transcription, great; you can skip manual intake entirely. If not, pass the form data directly to the extraction endpoint. Create a Freed AI API request node in n8n:

POST https://api.freedai.com/v1/extract
Headers: Authorization: Bearer YOUR_FREED_API_KEY Content-Type: application/json { "text": "{{ $json.form_data }}", "extract_fields": [ "diagnosis", "symptoms", "medications", "medical_history", "allergies" ]
}

Freed will return structured JSON with high confidence scores:

json
{ "diagnosis": { "value": "Type 2 Diabetes", "confidence": 0.98 }, "medications": { "value": "Metformin 500mg twice daily", "confidence": 0.95 }, "symptoms": { "value": "Increased thirst, fatigue", "confidence": 0.92 }
}

Map these outputs to n8n variables for the next step.

Step 2: Generate Personalised Script with Claude

This is the intelligence layer. Use Claude Opus 4.6 because it's better than o4-mini at instruction following and generating coherent long-form content. Add an HTTP request node (or use n8n's native OpenAI node, then swap the model to Anthropic via API):

POST https://api.anthropic.com/v1/messages
Headers: x-api-key: YOUR_ANTHROPIC_API_KEY Content-Type: application/json { "model": "claude-opus-4.6", "max_tokens": 2000, "messages": [ { "role": "user", "content": "You are a healthcare educator. Write a 1,500-word patient education script for {{ $json.patient_name }}, a {{ $json.age }}-year-old with {{ $json.diagnosis }}. They are currently taking {{ $json.medications }}. Their reported symptoms are {{ $json.symptoms }}. The script should be conversational, use grade 6 reading level, include: (1) what the condition is, (2) why symptoms occur, (3) how their medication works, (4) lifestyle modifications, (5) when to seek emergency care. Target format: spoken word, natural pauses, no markdown." } ]
}

Store the returned script in an n8n variable; call it patient_education_script.

Step 3: Generate Video with HeyGen or Hour One

HeyGen is faster (API-first, ~2 minutes per video). Hour One is cheaper per minute but slower. For a clinic workflow expecting quick turnaround, HeyGen makes sense.

POST https://api.heygen.com/v1/video_generate
Headers: X-API-Key: YOUR_HEYGEN_API_KEY Content-Type: application/json { "template_id": "professional_presenter_1", "script": "{{ $json.patient_education_script }}", "avatar_id": "avatar_1", "voice_id": "en_female_warm", "output_format": "mp4", "quality": "720p"
}

HeyGen returns a video_id and a polling endpoint. You'll need to wait for completion:

GET https://api.heygen.com/v1/video_generate/{{ $json.video_id }}/status

Add a polling loop in n8n (wait node + HTTP node) until status is COMPLETED. Once done, retrieve the video URL from the response.

Step 4: Upload and Send to Patient

Store the video URL in your clinic's HIPAA-compliant storage (AWS S3 with encryption, or a dedicated patient portal). Generate a signed URL or unique token so only the patient can access it. Then send notification:

POST https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json
Headers: Authorization: Basic [base64-encoded credentials] { "From": "+1XXXXX", "To": "{{ $json.patient_phone }}", "Body": "Hi {{ $json.patient_name }}, your personalised education video about {{ $json.diagnosis }} is ready. Watch it here: {{ $json.video_url }}"
}

Or via email using n8n's built-in Email node. Complete n8n Configuration Summary: 1. Webhook trigger (receives form POST) 2. HTTP node (calls Freed AI extraction) 3. Set variable node (extract structured fields) 4. HTTP node (calls Claude API for script generation) 5. HTTP node (calls HeyGen video generation) 6. Polling loop (waits for video completion) 7. HTTP node (uploads video to storage) 8. Twilio or Email node (sends notification to patient) 9. Database node (logs completion for audit trail) Connect error handling to each node; on failure, send notification to clinic admin with the patient ID and error message.

The Manual Alternative

If you want human review before sending videos, insert a manual approval step. After HeyGen finishes, the workflow pauses and notifies a clinician via Slack with a preview link. They approve or request regeneration (e.g. "script needs to mention exercise more"). n8n can handle this with a "Wait for Webhook" node that waits for approval input. This adds 1-2 hours of latency but gives clinicians confidence that videos match their standard of care. Most clinics start automated, then move to manual approval only for high-risk diagnoses.

Pro Tips

Rate limiting and batching.

HeyGen allows 50 concurrent video generations on paid plans, but Anthropic has per-minute token limits.

For a busy clinic, batch videos overnight rather than processing intake forms in real-time. Add a delay node between form submission and Claude API call; queue forms in a database and process them in batches of 5-10 with staggered timing.

Fallback for extraction failure.

If Freed AI can't extract diagnosis (confidence < 0.85), set a conditional node to flag for manual review instead of failing the entire workflow. Send a Slack notification to clinic staff: "Form for John Doe: diagnosis extraction failed, review manually". Don't force personalisation on incomplete data.

Video avatar customisation.

HeyGen's avatar selection matters. Use a diverse set of avatars; patients respond better when the avatar's demographic roughly matches their own. Store avatar preference in patient records and pull it dynamically.

Reuse scripts for cohorts.

If ten patients have Type 2 Diabetes and similar presentations, generate one script and reuse it, personalising only the name and specific medication details. This cuts Claude API costs by 90% for common conditions. Track which diagnoses hit this scenario.

Cost per video.

Monitor actual spend. HeyGen's API pricing is roughly £0.10 per minute of video. A 10-minute education video costs ~£1. Claude Opus script generation for 2,000 tokens costs ~£0.06. Total per patient: ~£1.10 excluding storage. A clinic processing 50 patients weekly spends ~£2,860 monthly; compare this against staff time spent manually editing videos or reviewing generic materials.

Cost Breakdown

ToolPlan NeededMonthly CostNotes
n8nSelf-hosted free or Cloud Pro£0 or £150Self-hosted recommended for HIPAA; Cloud Pro for smaller clinics
Freed AIProfessional£200HIPAA-compliant; includes extraction API
Claude Opus 4.6Pay-as-you-go£50-150Depends on script volume; ~50 patients weekly = ~£100
HeyGenProfessional£250200 video generations per month; scale up at £1 per extra
Twilio SMSPay-as-you-go£20-50~1 SMS per patient
AWS S3 + encryptionStandard£10-301GB storage ~£0.02/GB; 50 videos ×10MB = negligible cost
TOTAL~£520-680For 50 patient videos weekly