Auto-Generate LinkedIn Promo Posts from Ghost Blog with n8n + GPT-4o
Ghost CMS articles → HTML cleanup → GPT-4o LinkedIn copy → Google Sheets archive
- Who
- Content creators, bloggers, or marketing teams running a Ghost blog who want automated LinkedIn promotion
- You get
- Pull latest blog posts, clean HTML, auto-generate LinkedIn posts with hook, summary, CTA and signature, then log everything to Google Sheets
- You need
- n8n · Ghost CMS · OpenAI GPT-4o / GPT-4o-mini · Google Sheets · Code node
Constraints
Prerequisites: Ghost CMS account with API credentials; Google Sheets with OAuth2 credentials; OpenAI API key; n8n instance. Trigger manually or via scheduler. Ghost node fetches posts; Edit Fields extracts id/title/url/html/feature_image/excerpt; Code node cleans HTML; Split In Batches loops each post into an AI Agent (GPT-4o-mini) with a structured system prompt; results are merged and appended to Google Sheets. Template built on n8n 1.85.4.
What they did
Author Samir Saci, a supply chain data scientist and content creator, submitted an n8n template that automatically extracts articles from his Ghost blog, cleans the HTML, and generates LinkedIn promo posts via GPT-4o-mini, archiving results to Google Sheets. The template includes complete node definitions: Manual Trigger, Ghost fetch, Edit Fields mapping, Code cleanup, Split In Batches loop, AI Agent (OpenAI Chat Model), Merge, and Google Sheets append.
How it went
The author reports that this workflow saves repetitive manual promotion time and boosts LinkedIn reach (author_report). The template is published in the n8n official library and had 5,406 views at time of collection.
Worth knowing
1. The template defaults to GPT-4o-mini, though the description mentions GPT-4o; users can switch models as needed. 2. Auto-publishing to LinkedIn requires additional tools (e.g., Buffer or Make); this template only generates copy. 3. The template can be adapted for Twitter, Facebook, or email newsletters by adjusting the prompt and output channel. 4. Built on n8n 1.85.4; newer versions may have minor UI differences. 5. This site has not tested the workflow; verify credentials and field mappings in a test environment before production use.
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
- After import, connect your own credentials on auth-required nodes; author secrets are not included.
Configuration to replace
- Source template is n8n public workflow #3500 (~14 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 Ghost and Google Sheets credentials
After importing the template into n8n, set up two credentials: 1) Ghost node: add Ghost Blog Account Credentials and select the number of posts to fetch (default limit=3). 2) Google Sheets node: add Google Sheets API OAuth2 credentials, choose the target file and sheet, and confirm field mapping (id, title, content, excerpt, clean_content, linkedin_post, featured_image).
Extract and map blog post fields
The Ghost node (Extract Blog Posts) pulls the post list in getAll mode. The Edit Fields (Extract Post Content) node then maps each post to: id, title, featured_image, excerpt, content (raw html), and link (url). These fields feed the cleanup and AI generation steps.
Execution prompt · Source text。Edit Fields node assignments: id field expression
={{ $json.id }}Execution prompt · Source text。Edit Fields node assignments: title field expression
={{ $json.title }}Execution prompt · Source text。Edit Fields node assignments: featured_image field expression
={{ $json.feature_image }}Execution prompt · Source text。Edit Fields node assignments: excerpt field expression
={{ $json.excerpt }}Execution prompt · Source text。Edit Fields node assignments: content field expression
={{ $json.html }}Execution prompt · Source text。Edit Fields node assignments: link field expression
={{ $json.url }}Clean HTML and feed to AI Agent
The Code node (Clean HTML) runs JavaScript to strip HTML tags, normalize whitespace, and decode , outputting clean_content. Then Loop Over Posts processes each item: title, link, and clean_content are injected into the AI Agent's user message, and GPT-4o-mini generates the LinkedIn promo copy according to the systemMessage structure.
Execution prompt · Source text。Clean HTML Code node jsCode field
const htmlContent = $input.first().json.content; const cleanText = htmlContent .replace(/<[^>]*>/g, '') // remove tags .replace(/\s+/g, ' ') // normalize spaces .replace(/ /g, ' ') // decode common entity .trim(); return [ { json: { clean_content: cleanText } } ];Execution prompt · Source text。AI Agent node text field (user message template)
=Article Title: {{ $json.title }} Article Link: {{ $json.link }} Article Content: {{ $json.clean_content }}Execution prompt · Source text。AI Agent node options.systemMessage field
=You are a content marketing assistant. Based on the article metadata (ID, title) and cleaned content, generate a short LinkedIn promotional message for a professional audience. Follow this structure: Start with a hook that grabs attention (a bold insight, surprising fact, or thought-provoking question). Briefly summarize the article’s value — what readers will learn or gain from it. Include a clear call-to-action encouraging readers to read the article. End with this author signature and invitation: “— Samir Saci Supply Chain Data Scientist & Founder of LogiGreen 📩 Contact me: https://logi-green.com/contactus” Use a professional and engaging tone. Do not include hashtags or Markdown formatting.
Merge results and write to Google Sheets
The AI Agent output is merged with original post data via the Merge Linkedin node, then the Google Sheets node appends a row to the specified sheet in append mode. Written fields: id, title, content, excerpt, clean_content, linkedin_post (AI output), featured_image. After running, review the generated LinkedIn copy alongside source data in Google Sheets.
Execution prompt · Source text。Google Sheets node columns.value: id
={{ $json.id }}Execution prompt · Source text。Google Sheets node columns.value: title
={{ $json.title }}Execution prompt · Source text。Google Sheets node columns.value: content
={{ $json.content }}Execution prompt · Source text。Google Sheets node columns.value: excerpt
={{ $json.excerpt }}Execution prompt · Source text。Google Sheets node columns.value: clean_content
={{ $json.clean_content }}Execution prompt · Source text。Google Sheets node columns.value: linkedin_post
={{ $json.output }}Execution prompt · Source text。Google Sheets node columns.value: featured_image
={{ $json.featured_image }}
Prompt you can copy
Setup guidance · Editorial suggestion。Setup starter: understand the AI Agent systemMessage structure, replace author signature and tone as needed, then paste into n8n
This block is the prompt. Ads are never placed here.
You are a content marketing assistant. Based on the article metadata (ID, title) and cleaned content, generate a short LinkedIn promotional message for a professional audience. Follow this structure: 1. Start with a hook that grabs attention (a bold insight, surprising fact, or thought-provoking question) 2. Briefly summarize the article's value — what readers will learn or gain from it 3. Include a clear call-to-action encouraging readers to read the article 4. End with an author signature and invitation Use a professional and engaging tone. Do not include hashtags or Markdown formatting.
Replace the author signature in the systemMessage with your own details; adjust tone or add extra requirements directly in the prompt before pasting it into the AI Agent node's systemMessage field.
Source
✍️ AI agent to create Linkedin posts for blog promotion with GPT-4o · samirsaci · n8n.io · 2025-04-09
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.