PDF to Ghost Blog Post: n8n Automation Workflow
Upload PDF → AI extracts and structures a blog post → Publish to Ghost CMS
- Who
- Content teams, digital publishers, anyone needing to turn PDFs into blog posts quickly
- You get
- PDFs automatically converted into structured, HTML-formatted blog drafts published to Ghost
- You need
- n8n · ghost
Constraints
Import the template workflow into n8n, configure OpenAI and Ghost Admin API credentials, and enable the form trigger. When a user uploads a PDF, the workflow extracts text, uses gpt-4o-mini with a system prompt to generate JSON with title and content, then passes through a code node for field separation and conditional validation before publishing to Ghost. Requires an n8n instance, OpenAI API key, and Ghost Admin API credentials. Costs depend on OpenAI usage and n8n hosting.
What they did
Author Joseph LePage (joe) published this workflow in the n8n official template gallery, demonstrating how to upload a PDF via form, use OpenAI gpt-4o-mini to generate structured blog content, and publish to Ghost CMS. The template includes complete node wiring, system prompt, JSON output parser, and error-handling code.
How it went
The author claims the workflow can convert long documents into blog posts in under one minute, reducing content production time by approximately 95% (author_report). The template has 7,376 views on n8n.io. This site has not tested execution.
Worth knowing
The system prompt specifies word counts, chapter counts, and HTML formatting, but actual output length is subject to model token limits; long PDFs may require chunking or adjusted expectations. The prompt advises 'avoid direct copying,' but users should still manually review for copyright and factual accuracy. The Ghost node creates a draft by default; change additionalFields to publish directly. The code node strips <h1> tags from content; this has no effect if no H1 is present.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Post to Ghost node: connect Ghost Admin API credentials.
- gpt-4o-mini node: connect OpenAI API credentials.
Configuration to replace
- Source template is n8n public workflow #2522 (~12 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure credentials
Add two credentials in n8n: 1) OpenAI API Key (type openAiApi) for the AI node; 2) Ghost Admin API credentials (type ghostAdminApi) for publishing. Ensure the Ghost credential has permission to create posts.
Upload PDF and extract text
The workflow starts with an n8n Form Trigger at path /pdf, titled 'PDF2Blog', accepting a single .pdf file. After upload, the Extract from File node extracts text with operation=pdf, binaryPropertyName pointing to the uploaded file field. You should see extracted plain text passed to the next node.
Configure AI generation node
Connect gpt-4o-mini (model ID gpt-4o-mini-2024-07-18, responseFormat set to json_object) as the language model, and Structured Output - JSON as the output parser with schema example {"title":"title","content":"content"}. The Create Structured Blog Post node uses conversationalAgent, promptType=define, and binds the above model and parser. retryOnFail is enabled.
Execution prompt · Source text。Create Structured Blog Post node systemMessage field (options.systemMessage)
=Analyze the provided PDF article and create a compelling blog post that will be returned in JSON format with two fields: "title" and "content". Follow these specifications: ## Title Requirements - Create an engaging, SEO-friendly title under 10 words - Must not contain a colon - Should capture the article's essence - Will be formatted as an H1 in the content ## Content Structure - Introduction (150-200 words) * Compelling hook * Topic context and importance * Preview of main points - Main Content (6-8 chapters) * Each chapter requires: - Relevant H2 heading - 300-400 words of unique content - Specific topic focus - Source material quotes/data - Smooth transitions - Conclusion (200-250 words) * Key takeaways * Final thoughts/implications ## Formatting Guidelines - Use proper HTML tags throughout - Structure with <p> tags for paragraphs - Include appropriate spacing - Use <blockquote> for direct quotes - Maintain consistent formatting - Write in clear, professional tone - Break up long paragraphs - Use engaging subheadings - Include transitional phrases The content should be original, avoid direct copying, and maintain a consistent voice throughout. The final JSON response should contain only the title and content fields, with the content including all HTML formatting.Parse output and validate
The Separate Title & Content code node receives AI output, validates the input[0].json.output.output structure, extracts title and content, and strips any existing <h1> tag from content. If title or content is missing, it returns a failure object with error/message/timestamp. Then the If node checks both title and content are non-empty: if true, flow proceeds to Post to Ghost; otherwise to Do Nothing.
Execution prompt · Source text。Separate Title & Content node jsCode field
try { // Check if input exists and has the expected structure const input = $input.all(); if (!input || !input.length) { throw new Error('No input data received'); } const firstItem = input[0]; if (!firstItem || !firstItem.json || !firstItem.json.output || !firstItem.json.output.output) { throw new Error('Invalid input structure: missing required properties'); } const output = firstItem.json.output.output; // Validate title exists if (!output.title) { throw new Error('Missing title in output'); } // Validate content exists if (!output.content) { throw new Error('Missing content in output'); } const title = output.title; const content = output.content.replace(/<h1>.*?<\/h1>/s, '').trim(); // Validate final content is not empty after processing if (!content) { throw new Error('Content is empty after processing'); } console.log('Successfully processed content'); console.log(title) console.log(content) return { title, content }; } catch (error) { // Log the error for debugging console.error('Error processing content:', error.message); // Return a graceful failure object return { error: true, message: error.message, title: '', content: '', timestamp: new Date().toISOString() }; }Publish to Ghost
The Post to Ghost node uses Ghost Admin API with operation=create, mapping title and content from the previous step's output. On success, a new draft blog post should appear in the Ghost admin panel with title and content populated.
Prompt you can copy
Setup guidance · Editorial suggestion。Give to setup assistant to confirm credentials and import/manual build order
This block is the prompt. Ads are never placed here.
You are reproducing the n8n template 'PDF2Blog'. First confirm you have an OpenAI API Key and Ghost Admin API credentials, then import the workflow JSON into n8n or build manually per the steps above. The main prompt is attached in step 3 prompts; paste it directly into the Create Structured Blog Post node's systemMessage. Test with a short PDF first to verify JSON output structure before processing long documents.
Configure credentials first, then test form upload; enable retryOnFail on the AI node
Source
📄🌐PDF2Blog - create blog post on Ghost CRM from PDF document · joe · n8n.io · 2024-11-04
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.