How to Auto-Generate LinkedIn Posts from Your Blog with n8n and AI

You publish a blog post every week. It’s great content—researched, written, polished. But then you face a familiar problem: how do you turn that article into a compelling LinkedIn post? Do you manually rewrite it? Copy-paste? Start from scratch? You end up spending 20 minutes crafting something that captures the essence of your article, and you repeat this every single week.

What if that rewriting happened automatically?

This guide walks you through building a workflow that pulls your latest blog posts from Ghost CMS, feeds them to an AI agent powered by GPT-4o-mini, and saves LinkedIn-ready promotional posts to a Google Sheet—all on a schedule, no manual work required. Get the complete template below.

What You’ll Build

By the end of this tutorial, you’ll have a fully automated workflow that:

  1. Fetches your latest blog posts from Ghost CMS every Monday morning at 9am
  2. Cleans up the HTML content to extract just the text, removing all markup and formatting noise
  3. Sends each post to an AI agent (GPT-4o-mini) with a custom prompt to generate a professional LinkedIn promotional post
  4. Appends everything to a Google Sheet where you can review, refine, or directly copy the AI-generated post to LinkedIn
  5. Repeats automatically every week, giving you a constantly growing library of pre-written LinkedIn content

How It Works — The Big Picture

Here’s the workflow architecture at a glance:

┌─────────────────────┐
│ Schedule Trigger    │ (Every Monday 9am)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Extract Blog Posts  │ (Ghost CMS - getAll, limit 3)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Map Post Fields     │ (Set node - extract id, title, etc.)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Process Each Post   │ (SplitInBatches - batch size 1)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Strip HTML Tags     │ (Code node - JS to remove markup)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Combine Post Data   │ (Merge node - SQL combine)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Generate LinkedIn   │ (AI Agent - GPT-4o-mini)
│ Post                │
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Merge AI Output     │ (Merge node - combine with original)
└──────────┬──────────┘
           │
           v
┌─────────────────────┐
│ Save to Sheets      │ (Google Sheets - append rows)
└─────────────────────┘

Each blog post flows through this pipeline independently. The workflow extracts relevant data, cleans it, feeds it to AI, and stores the result in a structured spreadsheet for your review.

What You’ll Need

Before you start building, make sure you have:

  • n8n account (free tier works fine, or self-hosted)
  • Ghost CMS with at least 3 published blog posts
  • Ghost Admin API key (generate in Settings → Integrations)
  • OpenAI API key with access to GPT-4o or GPT-4o-mini
  • Google Sheets API credentials (or just use n8n’s built-in Google Sheets connector)
  • A Google Sheet ready to receive the data
  • Time commitment About 45 minutes to build and test the entire workflow

Building the Workflow

Let’s build this step by step. I’ll walk you through each node, what it does, and how to configure it.

1 Schedule Trigger: Weekly Automation

Start with a Schedule node to run your workflow every Monday morning at 9am Eastern Time.

Configuration:

  • Choose Recurring as the trigger type
  • Set Trigger Type to Weekly
  • Select Monday (or your preferred day)
  • Set the time to 09:00:00 (9am)
  • Set timezone to America/New_York

This node outputs a single object with a timestamp. It doesn’t pass data forward—it just kicks off the workflow on schedule.

📌

Pro tip: If you want to test the workflow immediately without waiting for Monday, you can manually trigger it by clicking the “Execute Workflow” button in n8n’s editor. No need to change the schedule.

2 Extract Blog Posts: Pull from Ghost CMS

Next, add a Ghost node configured to fetch your latest blog posts.

Configuration:

  • Create a new Ghost connection using your Admin API key
  • Set the resource to Posts
  • Set the operation to Get All
  • Under “Options,” set Limit to 3 (fetch the 3 most recent posts)
  • Enable Include HTML so we capture the full content

Expected output (sample):

[
  {
    "id": "post_5a2k8x9m",
    "title": "5 Ways to Automate Your Marketing Funnel in 2026",
    "featured_image": "https://ghost.easyworkflows.net/content/images/2026/04/marketing-funnel.jpg",
    "excerpt": "Automation is no longer a luxury...",
    "html": "<h2>Automation is...</h2><p>...",
    "slug": "5-ways-automate-marketing-funnel-2026",
    "published_at": "2026-04-08T08:00:00Z"
  },
  ...
]

3 Map Post Fields: Extract What We Need

Now use a Set node to pluck out just the fields we care about. This keeps our data clean and reduces noise downstream.

Configuration:

  • Add a Set node after the Ghost node
  • In the “Set” section, map these fields from the Ghost posts:
    • idid
    • titletitle
    • featured_imagefeatured_image
    • excerptexcerpt
    • contenthtml
    • link ← construct using slug: https://yourblog.ghost.io/{{$node["Ghost"].data.slug}}/

At this point, each post has a clean data structure with just what we need.

4 Process Each Post: Use SplitInBatches

Since we fetched multiple posts, we need to process them one at a time. A SplitInBatches node lets us handle each post independently before merging results back together.

Configuration:

  • Add a SplitInBatches node
  • Set Batch Size to 1
  • Set Options → Timeout to 120 seconds (gives AI time to respond)

This node splits the array of posts into single-item batches. Each batch loops through the remaining nodes.

5 Strip HTML Tags: Clean the Content

The Ghost CMS gives us HTML-rich content, but we want plain text for the AI. A Code node will strip all HTML tags and clean up whitespace.

Configuration:

  • Add a Code node (JavaScript)
  • Paste this function:
const htmlContent = $node["Map Post Fields"].data.content;

// Strip HTML tags
let cleanText = htmlContent.replace(/<[^>]+>/g, '');

// Decode HTML entities
cleanText = cleanText
  .replace(/&/g, '&')
  .replace(/</g, '<')
  .replace(/>/g, '>')
  .replace(/"/g, '"')
  .replace(/'/g, "'");

// Remove extra whitespace
cleanText = cleanText
  .replace(/\s+/g, ' ')
  .trim();

return { clean_content: cleanText };

Output example:

{
  "clean_content": "5 Ways to Automate Your Marketing Funnel in 2026 Automation is no longer a luxury. It's a necessity..."
}

6 Combine Post Data: Merge Original + Cleaned

We now have two pieces of data floating around: the original post fields and the cleaned content. A Merge node combines them back into a single, complete object.

Configuration:

  • Add a Merge node
  • Merge mode: Combine
  • Input 1: Output from “Map Post Fields” (original fields)
  • Input 2: Output from “Strip HTML Tags” (cleaned content)

Result:

{
  "id": "post_5a2k8x9m",
  "title": "5 Ways to Automate Your Marketing Funnel in 2026",
  "featured_image": "https://...",
  "excerpt": "Automation is no longer a luxury...",
  "content": "<h2>...</h2>...",
  "link": "https://yourblog.ghost.io/...",
  "clean_content": "5 Ways to Automate... [full plain text]"
}

7 Generate LinkedIn Post: AI Agent with GPT-4o-mini

Now the magic happens. We send the cleaned blog content to an AI Agent node powered by OpenAI, which generates a professional LinkedIn promotional post.

Configuration:

  • Add an AI Agent node
  • Model: gpt-4o-mini
  • Credentials: Connect your OpenAI API key
  • System Prompt: Copy and customize this:
    You are a LinkedIn content specialist. Your job is to transform blog articles into engaging, professional LinkedIn posts.
    
    Guidelines:
    - Keep it between 3-5 sentences
    - Use 1-2 relevant emojis (but not too many)
    - Include a call-to-action at the end (e.g., "Read the full article below" or "What's your experience?")
    - Maintain a professional but friendly tone
    - Focus on the key insight or takeaway from the blog post
    - Do NOT include hashtags
    
    Format your response as plain text only.
  • User Message: Set this to:
    Blog Title: {{$node["Combine Post Data"].data.title}}
    
    Blog Content:
    {{$node["Combine Post Data"].data.clean_content}}
    
    Generate a LinkedIn promotional post for this blog article.

Expected output:

"In 2026, your marketing stack is only as strong as your automation. We just published a deep dive into 5 game-changing automation strategies that cut manual work, reduce errors, and scale your growth.

Whether you're managing leads, nurturing prospects, or coordinating campaigns, automation does the heavy lifting. Curious how? Check out the full breakdown below. 📈

What automation tool has made the biggest impact for you?"
💡

Not getting the tone you want? Tweak the system prompt. Ask the AI to be more casual, more technical, more sales-focused, whatever fits your brand. The beauty of AI agents is they adapt to your instructions.

8 Merge AI Output: Combine Generated Post with Metadata

The AI agent returned a LinkedIn post, but we also want to keep the original blog metadata (title, link, featured image) so we can reference them in the Google Sheet.

Configuration:

  • Add another Merge node
  • Merge mode: Combine
  • Input 1: Output from “Combine Post Data” (all original + cleaned fields)
  • Input 2: Output from “Generate LinkedIn Post” (the AI-generated text)
  • In Input 2, set the field name to linkedin_post so the AI output is clearly labeled

Final merged object:

{
  "id": "post_5a2k8x9m",
  "title": "5 Ways to Automate Your Marketing Funnel in 2026",
  "featured_image": "https://...",
  "excerpt": "Automation is no longer a luxury...",
  "content": "<...>",
  "clean_content": "5 Ways to Automate... [plain text]",
  "link": "https://yourblog.ghost.io/...",
  "linkedin_post": "In 2026, your marketing stack is only as strong..."
}

9 Save to Google Sheets: Append the Results

Finally, append each row to your Google Sheet so you have a growing library of LinkedIn posts ready to go.

Configuration:

  • Add a Google Sheets node
  • Credentials: Authenticate with your Google account
  • Spreadsheet: Select or paste the ID of your sheet
  • Sheet: Choose the sheet tab (e.g., “Posts”)
  • Resource: Append
  • Columns to append: Map these fields:
    • id
    • title
    • featured_image
    • excerpt
    • link
    • clean_content
    • linkedin_post

Each week, new rows are added to the bottom of your sheet with the original blog data and the AI-generated post.

The Data Structure

Here’s exactly how your Google Sheet should be organized. Create these column headers in row 1:

id title featured_image excerpt link clean_content linkedin_post
post_5a2k8x9m 5 Ways to Automate Your Marketing Funnel in 2026 https://ghost.easyworkflows.net/content/images/2026/04/marketing-funnel.jpg Automation is no longer a luxury. It’s a necessity… https://blog.easyworkflows.net/marketing-automation-2026/ 5 Ways to Automate Your Marketing Funnel in 2026 Automation is no longer a luxury… In 2026, your marketing stack is only as strong as your automation. We just published a deep dive into 5 game-changing automation strategies…
post_3j9m2x5k Why n8n is Better Than Zapier for Complex Workflows https://ghost.easyworkflows.net/content/images/2026/04/n8n-vs-zapier.jpg When it comes to no-code automation, flexibility matters… https://blog.easyworkflows.net/n8n-vs-zapier-comparison/ Why n8n is Better Than Zapier for Complex Workflows When it comes to no-code automation, flexibility matters… Ever hit a wall with Zapier because it can’t do exactly what you need? n8n is different. We compared side-by-side, and the results might surprise you. Read our full breakdown…

The featured_image column is great for visual reference. The link column lets you click straight to the blog post. And linkedin_post is what you’ll actually copy into LinkedIn when you’re ready to post.

Full System Flow

Here’s a more detailed view of the entire workflow end-to-end:

WORKFLOW: Auto-Generate LinkedIn Posts from Blog Content

┌──────────────────────────────────────────────────────┐
│ 1. SCHEDULE TRIGGER                                  │
│    Runs: Every Monday at 9:00 AM (America/New_York) │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 2. GHOST CMS NODE                                    │
│    Fetches: Latest 3 published blog posts            │
│    Fields: id, title, excerpt, html, featured_image │
│    Output: Array of 3 post objects                   │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 3. SET NODE (Map Fields)                             │
│    Extracts: id, title, featured_image, excerpt,    │
│             content (html), link (slug-based)        │
│    Output: Cleaned post object                       │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 4. SPLIT IN BATCHES NODE                             │
│    Batch Size: 1                                     │
│    Processes: Each post individually in loop         │
│    Output: Single post object (batch)                │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 5. CODE NODE (Strip HTML)                            │
│    Removes: All HTML tags                            │
│    Cleans: Whitespace, HTML entities                │
│    Output: { clean_content: "plain text..." }        │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 6. MERGE NODE (Combine)                              │
│    Input 1: Original post fields                     │
│    Input 2: clean_content from Code node             │
│    Output: Single object with all fields             │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 7. AI AGENT NODE (OpenAI GPT-4o-mini)                │
│    System Prompt: LinkedIn content specialist        │
│    Input: Blog title + clean_content                 │
│    Generates: Professional LinkedIn post (3-5 sent.) │
│    Output: { text: "In 2026, your marketing..." }    │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 8. MERGE NODE (Combine with Metadata)                │
│    Input 1: All original fields + clean_content      │
│    Input 2: AI-generated linkedin_post               │
│    Output: Complete object ready for Sheets          │
└────────────────┬─────────────────────────────────────┘
                 │
                 v
┌──────────────────────────────────────────────────────┐
│ 9. GOOGLE SHEETS NODE (Append)                       │
│    Spreadsheet: "LinkedIn Auto-Posts"                │
│    Sheet Tab: "Posts"                                │
│    Appends: 1 row per blog post                      │
│    Columns: id, title, featured_image, excerpt,      │
│            link, clean_content, linkedin_post        │
└──────────────────────────────────────────────────────┘

RESULT: Every blog post → 1 professional LinkedIn post
        Stored in Google Sheet for review & scheduling

Testing Your Workflow

Before you set it to run on schedule, test it end-to-end. Here’s the checklist:

  1. Execute the workflow manually from the n8n editor (click the play button)
  2. Check the Ghost node output — do you see your 3 recent posts?
  3. Check the Set node output — are all the fields (title, link, content) correct?
  4. Check the Code node output — is the HTML stripped? Is clean_content plain text?
  5. Check the AI Agent output — is the generated LinkedIn post sensible? Does it match your tone?
  6. Check Google Sheets — did the row appear? Are all columns populated?
  7. Copy the LinkedIn post to LinkedIn — does it read well? Would you actually post it?

Troubleshooting table:

Problem Likely Cause Solution
Ghost node returns no posts Admin API key invalid or no published posts Verify API key in Ghost integration; ensure you have 3+ published posts
AI Agent times out Content too long or OpenAI API slow Reduce blog excerpt length; increase timeout in SplitInBatches to 180s
Google Sheets append fails Missing column headers or wrong Sheet ID Manually create header row in Sheet; verify Spreadsheet ID matches
AI-generated post is bland System prompt too generic Customize system prompt with your brand voice, target audience, examples
Duplicate rows in Sheet Workflow executed multiple times Check n8n execution logs; disable “activate” if not ready to run on schedule

Frequently Asked Questions

Can I use WordPress or RSS instead of Ghost CMS?

Absolutely. Replace the Ghost node with a WordPress node (if available in n8n) or use an RSS node to pull your latest posts. The rest of the workflow stays the same. You’ll just need to adjust the field mappings to match WordPress’s output format (e.g., post_content instead of html).

Can I use a different AI model instead of GPT-4o-mini?

Yes. You can swap in Claude 3.5 Sonnet, Gemini, or any other LLM supported by n8n. The workflow structure stays identical—just update the AI Agent node credentials and model selection. Different models may produce slightly different tones, so test and see which you prefer.

How do I customize the LinkedIn post style to match my brand voice?

Edit the System Prompt in the AI Agent node (Step 7). Add specific instructions about your brand voice, target audience, desired length, tone, and format. For example: “Use more technical language,” “Add industry jargon,” “Make it humorous,” “Include a specific CTA.” The AI will adapt accordingly.

Can I auto-post directly to LinkedIn instead of saving to a sheet first?

Not yet—LinkedIn’s API is limited, and n8n doesn’t have a direct “post to LinkedIn feed” node. However, you can use LinkedIn’s RSS feed directly or integrate with a tool like Buffer or Later that connects to n8n. For now, using Google Sheets as a review layer is the safest approach; it gives you a chance to tweak the AI output before publishing.

How many blog posts can I process at once?

The workflow processes posts one at a time (batch size 1) to avoid rate-limiting and stay within API cost bounds. If you want to fetch more than 3 posts, increase the Limit in the Ghost node. Keep in mind: each post calls the OpenAI API, so processing 10 posts will cost more than processing 3. Start with 3 and scale as needed.

💡

Want to take this further? Try setting up a second workflow that watches your Google Sheet and automatically schedules posts to LinkedIn via Buffer on specific days. Or build a variation that emails the LinkedIn post to your team for approval before it hits the sheet. Check out our templates library for more advanced workflows.

Get the Complete Workflow Template

Don’t want to build it from scratch? We’ve packaged the entire workflow—all 9 nodes pre-configured and ready to import—so you can get up and running in minutes, not hours.

Download the Template

Includes step-by-step setup guide and troubleshooting tips.

What’s Next?

You now have a powerful foundation. Here are four natural extensions to consider:

  1. Multi-platform distribution — Fork the workflow to generate Twitter posts, email newsletters, or Slack announcements from the same blog content.
  2. A/B testing variants — Call the AI agent twice with different system prompts and store both versions in the sheet. See which one gets more engagement on LinkedIn, then refine your prompt based on the winner.
  3. Sentiment and keyword extraction — Add a node to analyze the blog post sentiment and extract key topics, storing them in the sheet for SEO and content tracking.
  4. Scheduled LinkedIn publishing — Integrate with Buffer or another scheduling tool to automatically queue the posts for posting at optimal times, bypassing the manual copy-paste step entirely.

The beauty of n8n is that each workflow is a building block. Start here, learn what works for your brand, and expand from there.


Questions? Run into issues? The n8n community forum is incredibly active, and our templates team is always available. Happy automating!

n8n
Ghost CMS
LinkedIn
OpenAI
Google Sheets
automation
content marketing

How to Build an AI SEO Content Engine with n8n and Google Gemini

How to Build an AI SEO Content Engine with n8n and Google Gemini

Learn how to build an automated content engine that generates SEO and GEO-optimized articles using n8n and Google Gemini, with smart distribution to WordPress, LinkedIn, and email.

What You’ll Build

This guide shows you how to create a fully automated AI content pipeline that:

  • Watches a Google Sheet for content ideas
  • Generates SEO/GEO-optimized articles with Google Gemini
  • Intelligently routes content to the right distribution channels
  • Publishes to WordPress, LinkedIn, email, and more

Getting Started

Access the complete workflow template and setup guides at: AI SEO Content Engine Template