Abstract Background
Back to Projects
n8nClaude AIGoogle SheetsTavilyGmailPubMedJavaScript

AI-Powered Medical Newsletter Automation

How I built a fully automated 'Morning Brew for doctors' an n8n pipeline that scans PubMed daily, uses Claude AI to filter and analyse clinical research, and delivers a polished specialty newsletter to medical residents every week without a single human writing a word.

▢ Key Challenge

Sourcing and filtering genuinely relevant medical research across 30 specialties at scale, without drowning the AI in irrelevant content or blowing the API budget. Ensuring the newsletter reads like a human medical editor wrote it, not a robot.

The Brief: Morning Brew for Doctors

The client wanted a medical newsletter with the voice and energy of Morning Brew authoritative, punchy, and genuinely useful but for medical residents and new attendings across up to 30 clinical specialties. Each specialty edition needed to land weekly, cover the latest PubMed research, and feel like it was written by a knowledgeable colleague, not an algorithm.

The challenge: doing this for 30 specialties manually would require a team of medical writers. The brief was to automate the entire pipeline end-to-end from article discovery to inbox delivery while keeping the output quality high enough that readers wouldn't suspect AI.

The Google Sheets Control Panel

Before writing a single workflow node, I designed the Google Sheets database that acts as the system's no-code control panel. Non-technical operators can manage the entire newsletter operation without touching n8n.

Screenshot of the Google Sheets control panel showing the Specialties tab with active toggles
Screenshot of the Google Sheets control panel showing the Specialties tab with active toggles
Sheet TabWhat It Controls
SpecialtiesMaster list : toggle any specialty on/off with a single cell. Stores specialty name, audience, and PubMed RSS URL
RSS_SourcesAdditional news sources per specialty (beyond PubMed), add any RSS feed URL
emailsSubscriber list per specialty - comma-separated, supports multiple recipients
TriviaPre-written medical trivia Q&A per specialty, AI generates on-the-fly if empty
IntroEditorial intro text prepended to each newsletter edition

Setting a specialty's active column to TRUE is the only step needed to include it in the next weekly run. The workflow reads this sheet at runtime and processes only active specialties.

The 8-Phase Automation Pipeline

The n8n workflow has 28 nodes organised into 8 phases. Here's how a single specialty travels from RSS feed to inbox:

1.Trigger & Setup : Weekly schedule fires; reads all active specialties from Google Sheets
2.Content Ingestion : Fetches PubMed RSS + additional specialty RSS feeds in parallel
3.Gatekeeper Filter : Keeps only articles from the last 7 days, deduplicates by title slug across sources, hard-caps at 15 articles to control AI costs
4.AI Analysis Loop : Tavily fetches full article text (not just RSS snippets); Claude Sonnet 4 analyses each article for specialty relevance and extracts structured insights
5.Story Selection : Selects top 5 articles; structures each as: What Changed / Why It Matters / Bottom Line / Read Study link
6.Trivia Preparation : Uses pre-written trivia from Sheets or generates specialty-specific trivia via Claude if the sheet is empty
7.Newsletter Composition : Claude Sonnet 4 writes the full newsletter in Markdown using a Morning Brew-style template
8.HTML Rendering & Delivery : JavaScript node converts Markdown to branded HTML email; Gmail sends to subscriber list

The AI Analysis: What Claude Actually Does

Claude Sonnet 4 is used in three distinct roles within the same workflow:

Analyst : Reviews each article against the specialty. Outputs structured JSON: {keep, title, what_changed, why_it_matters, bottom_line, original_url}. Strict specialty matching, a cardiology newsletter won't include a gastroenterology study, but will flag major FDA updates that affect all physicians
Trivia Generator : Falls back to generating a difficult, specialty-specific medical trivia question when the Sheets database has no entry for that specialty
Editor/Writer : Takes the 5 selected stories + trivia + intro text and writes the complete newsletter in Morning Brew voice. Outputs full Markdown with frontmatter metadata (subject line, preheader) for the HTML renderer to consume

Smart Cost Controls

Running AI analysis on 30 specialties weekly adds up. I built cost controls into the pipeline architecture:

15-article hard cap per specialty entering the AI pipeline (Gatekeeper node)
Only 5 articles pass through to the newsletter, the Selector node makes the editorial cuts
Tavily content extraction only runs on articles that passed the Gatekeeper, no wasted API calls on stale or duplicate content
Pre-seeded trivia database in Google Sheets, Claude only generates trivia when the sheet has nothing, saving ~1 API call per specialty per week
Fault tolerance throughout, broken RSS feeds use continueRegularOutput, so one bad feed doesn't crash the entire specialty run

The Output: Branded HTML Email

A JavaScript node in n8n handles the Markdown-to-HTML conversion, producing a fully branded email with:

Navy (#103055) and blue (#0056b3) colour scheme with Merriweather serif headings
Weekly Snapshot : 3 punchy bullet points summarising the week's most important updates
Top Clinical Updates : 5 full stories with What Changed / Why It Matters / Bottom Line / Read Study CTA buttons
Resident Trivia section : one difficult specialty-specific question with answer
Auto-generated subject line incorporating specialty name and send date
Sample of Newsletter
Sample of Newsletter

Results & Impact

Delivered a production-ready newsletter system covering up to 30 medical specialties. Each specialty gets its own weekly edition fully written, formatted as a branded HTML email, and delivered to subscribers automatically. Non-technical operators manage the entire system through a Google Sheet: toggle specialties, manage subscribers, update content, add trivia no workflow editing required.