Automated AI Blog Post Generation and Ghost CMS Publishing - n8n Workflow

Use this powerful n8n workflow to automatically generate high-quality blog posts using GPT-4 and publish them directly to your Ghost CMS via the Admin API. Leverage sophisticated n8n templates for content automation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content marketers and SEO specialists needing high-volume, automated content.

  • Blog owners using Ghost CMS who want to leverage AI for rapid drafting.

  • Developers seeking advanced examples of using the n8n Code node for complex text parsing.

  • Users looking for robust n8n templates integrating AI services with publishing platforms.

Overview

Generating consistent, high-quality blog content manually can be a significant bottleneck. This comprehensive n8n workflow solves this by fully automating the content creation and publishing lifecycle. Starting with a time-based n8n trigger, it prompts a powerful OpenAI model (GPT-4) not only to write the main body of the article but also to simultaneously generate essential SEO metadata: a title, meta description, and five relevant tags.

The core strength of this n8n workflow lies in its subsequent processing steps, using custom JavaScript within the n8n node structure to meticulously parse the AI's response, clean the content, convert it into the required Ghost mobiledoc format, and finally, execute an authenticated API call to instantly publish the content to your Ghost CMS instance. This specific n8n template is ideal for maintaining content velocity with minimal human intervention.

How it Works

This automation follows a precise, five-step sequence:


  1. Scheduled Execution (n8n Trigger): The n8n workflow begins with a Schedule Trigger, set to run automatically every 12 hours. This acts as the primary n8n trigger, initiating the entire content generation process.

  2. AI Content Generation: The workflow proceeds to the OpenAI n8n node, which uses a predefined prompt to request a thoughtful blog post, a counterpoint paragraph, a title, a meta description, and 5 tags from the GPT-4 model.

  3. Metadata Extraction & Cleaning: The first Code n8n node receives the raw text output. It utilizes regular expressions to accurately separate the title, meta description, and tags from the main article body. It then wraps the cleaned body content in basic HTML, preparing the data for the Ghost API structure.

  4. Ghost Mobiledoc Conversion: The second Code n8n node transforms the extracted content into the specific JSON format required by the Ghost Admin API, known as mobiledoc. This includes structuring the tags and confirming the 'published' status.

  5. Publishing to CMS: Finally, an HTTP Request n8n node leverages Ghost Admin API credentials to send a POST request to the Ghost endpoint. This action instantly publishes the newly generated, AI-written content, completing the automated n8n workflow cycle.

Installation Guide

To deploy this powerful n8n workflow, follow these setup steps:


  1. Import: Copy the provided JSON data and import it directly into your n8n instance as a new workflow.

  2. OpenAI Credentials: Locate the OpenAI n8n node and ensure you have configured valid API credentials for your OpenAI account.

  3. Ghost API Setup: Ghost requires specific credentials for admin access. You must create an API key and secret within your Ghost CMS settings.

  4. Ghost n8n Node Configuration: In the HTTP Request n8n node:

Ensure the URL is updated to your specific Ghost instance (e.g., https://yourcustomurl.com/ghost/api/admin/posts/).
Set up a new credential of type 'Ghost Admin API' using the key and secret generated in step 3. The provided n8n node uses the 'ghostAdminApi' predefined credential type.

  1. Activation: Once credentials are set, activate the n8n workflow. The Schedule Trigger will begin generating and publishing posts automatically based on the 12-hour interval.

Node Details

Schedule Trigger (n8n Trigger)
Function: Acts as the starting point for the n8n workflow, ensuring recurring automation.
Key Configuration: Set to run every 12 hours, ensuring consistent content output.
OpenAI (n8n node)
Function: Generates the blog post content, title, meta description, and tags based on the comprehensive prompt.
Key Configuration: Uses GPT-4 class models and sends a specific structured prompt demanding metadata alongside the article body.
Code (n8n node) - Extraction
Function: Crucial parsing logic using JavaScript and regex to cleanly extract structured data (Title, Meta, Tags) from the raw AI text response.
Key Configuration: Uses Regex matching (content.match) to pull specific fields and removes the metadata from the final body, preparing for Ghost consumption.
Code1 (n8n node) - Conversion
Function: Formats the extracted data into the mobiledoc structure required by the Ghost Admin API for publishing articles.
Key Configuration: Explicitly converts the tag array into objects with a name key and wraps the HTML content into the necessary cards structure.
HTTP Request1 (n8n node)
Function: Executes the final publishing action by sending the structured payload to the Ghost Admin API endpoint.
* Key Configuration: Method is POST, uses 'Ghost Admin API' predefined credentials for secure authentication, and the JSON body contains the full post data in the mobiledoc format.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Featured*