Live — Project 4 of 5
Topic in.
Published post out.
A fully automated content pipeline that takes a topic, runs it through three chained Claude API calls — research, writing, SEO — and publishes a finished blog post to Ghost CMS. Zero human writing required.
Content marketing is expensive and slow
A single blog post — researched, written, SEO-optimised, and published — takes a skilled writer 3 to 6 hours. For businesses publishing weekly, that’s a serious bottleneck.
This pipeline collapses that 3–6 hours into under 2 minutes. A marketing manager enters a topic, clicks submit, and a fully written, SEO-optimised post appears in their CMS draft queue — ready to review and publish. The human stays in control of the publish decision; the AI handles all the creation work.
How the workflow runs end to end
Every step below is a node in a single n8n workflow. The pipeline fires on a webhook, runs three Claude API calls in sequence, assembles the Ghost post payload, publishes it, and returns the result to the UI.
Three Claude calls, three different jobs
Each Claude call in the pipeline uses a distinct system prompt tuned for its specific task. This is multi-step prompt chaining — not a single AI call, but a coordinated chain of specialist agents.
Research & Outline
Generates a structured JSON outline: H1 title, target audience description, 5 section headings, and 3–5 key points per section. Forces JSON-only output — no prose.
{ title, targetAudience,
sections: [{ heading,
keyPoints[] }] }
Full Draft
Expands the outline into a complete 600–900 word blog post in clean HTML. Uses h2, p, ul, and li tags only. Leads with value, short paragraphs, practical takeaway at the end.
<h2>Section Heading</h2>
<p>Body text...</p>
<ul><li>Point</li></ul>
SEO Meta
Generates complete SEO metadata from the post title and excerpt. Enforces character limits: 60 chars for meta title, 155 for meta description, lowercase-hyphenated slug.
{ metaTitle, metaDescription,
slug, focusKeywords[] }
Tech stack & how it connects
→
Netlify Proxy
→
n8n Webhook
→
Claude API ×3
→
Ghost CMS
→
Published Post
The JSON sanitisation problem (and fix)
When Claude’s response text (containing newlines or special characters) is interpolated directly into a JSON body in n8n’s HTTP Request node, it causes Bad control character in string literal errors. This took real debugging to solve.
Claude returns multi-line JSON or HTML. Feeding it directly into the next HTTP Request node’s JSON body breaks the payload — control characters like \n and \t inside string values are invalid in raw JSON bodies.
Insert a Code node between each Claude call and the next HTTP Request. Strip all control characters with .replace(/[\x00-\x1F\x7F]/g, ' '), store the clean value in a variable, then reference {{ $json.cleanField }} in the JSON body.
const outlineRaw = $('Claude — Research & Outline').item.json.content[0].text; const language = $('Webhook (form submit)').item.json.body.language || 'English'; // Strip control characters that break JSON interpolation const cleanOutline = outlineRaw .replace(/[\x00-\x1F\x7F]/g, ' ') .replace(/"/g, '\\"'); return [{ json: { cleanOutline, language, outlineRaw } }];
What this project proves
Three Claude API calls in sequence, each with a distinct system prompt — research, writing, SEO. Not a single-shot prompt, but a coordinated chain of specialist agents.
8-node workflow with webhook trigger, HTTP Request nodes, Code nodes for data transformation, and Ghost API integration — all wired together without a single line of server code.
Ghost Admin API with JWT authentication. Programmatic post creation with full metadata — title, HTML body, slug, meta tags, and focus keywords.
Each prompt enforces a strict output format (JSON or HTML only, no prose, no code fences) and character constraints. Reliable structured output from LLMs.
Solved the JSON control character problem that breaks n8n ↔ Claude integrations — a real-world issue not covered in tutorials. The fix is reusable across projects.
n8n.cloud for workflow hosting, Netlify for the demo frontend with serverless proxy, Ghost for CMS. Full stack deployed and smoke-tested end to end.
Who pays for this kind of automation
Want this pipeline built for your business?
I build custom AI automation workflows — content pipelines, lead gen, document processing, CRM integration. Let’s talk about what you need.
