Back to Templates

End-to-End Blog Generation for WordPress with LLM Agents&Image - GPT-5 Optimized

Last update

Last update 2 months ago

Share


🧠 n8n Blog Automation Workflow — GPT-5 Optimized

This is a ready-to-use, single workflow — you can copy and paste it directly into n8n and start working.
It handles end-to-end SEO blog automation with triggers, orchestration, AI-powered writing, metadata, tags, excerpts, WordPress publishing, and Google Sheets updates.


📌 Overview

The system accepts blog parameters either from a form submission or from a Google Sheet row (via scheduled trigger), dynamically fetches WordPress categories, and produces a complete, publication-ready post through an orchestrated sequence of GPT-5 agents.
Each agent executes once in a strict order with clearly defined responsibilities.

Core Capabilities

  • Real-time search and fact retrieval (OpenRouter / Perplexity Sonar)
  • SEO-focused outline planning
  • Structured section creation
  • Expert-level section writing with inline HTML citations
  • Editorial refinement into cohesive, polished HTML
  • Metadata, excerpt, and featured-image prompt generation
  • Automated category, tag creation/update, and excerpt update
  • Draft publishing to WordPress
  • Updates the corresponding Google Sheet row with created = yes

🔁 Triggers

1. Form Trigger

Collects:

  • Keywords
  • Word count
  • Number of sections
  • Writing style
  • Website URL
  • About Website (used for context)
  • Featured image toggle

2. Google Sheets + Schedule Trigger

Automatically pulls rows on schedule from a Google Sheet with the following columns:

  • Keywords
  • wordCount
  • Number of sections
  • Generate a featured image
  • Writing Style
  • Website
  • About Website
  • created → initially set to no, automatically updated to yes once the blog post is created and uploaded to WordPress.

🧠 Orchestration Agent (GPT-5)

Central Director agent optimized for GPT-5 that coordinates the pipeline:

  1. GetOnlineInfo — Current Q&A and search-driven insights
  2. OutlinePlanner — SEO-structured Table of Contents
  3. createSections — ToC → detailed section definitions
  4. SectionsWriter — Expert, citation-rich content
  5. Editor — Full HTML assembly, SEO and legal compliance
  6. MetaInfo — Title, slug, excerpt, meta description, category selection
  7. Tags Agent — Creates or updates SEO-friendly WordPress tags
  8. ImagePrompt — Realistic cover image prompt + alt text (if enabled)

✍️ Writing Flow

  1. Input parsing (from Form or Google Sheets row)
  2. Real-time data retrieval
  3. SEO-optimized outline creation
  4. Section breakdown with clear descriptions
  5. Detailed section drafting with verified sources
  6. Editorial polishing into publish-ready HTML
  7. Metadata and excerpt generation (title, slug, description, category)
  8. Tag creation and update in WordPress
  9. Optional image prompt creation and upload
  10. Automatic WordPress draft publishing with excerpt and tags updated
  11. Google Sheet row update — set created = yes

✅ Output Format

{
  "toc": "Table of Contents",
  "post_html": "<final HTML content>",
  "meta_data": {
    "title": "...",
    "slug": "...",
    "excerpt": "...",
    "category_id": 0
  },
  "image_data": {
    "image_prompt": "...",
    "alt_text": "..."
  },
  "tags": [
    {"name": "...", "description": "..."}
  ],
  "ready": true
}

🌐 WordPress Integration

  • Authenticated API calls to /wp-json/wp/v2/posts, /wp-json/wp/v2/media, and /wp-json/wp/v2/tags
  • Draft mode publishing with category & author assignment
  • Featured image creation, resizing, and metadata linking (if enabled)
  • Automatic creation and update of tags
  • Automatic creation and update of excerpts

🧩 Setup Instructions

1. Required Credentials

  • WordPress API credentials
  • OpenAI API key
  • OpenRouter API key (optional)
  • Google Sheets API credentials (if using scheduled trigger)

2. Sub-Workflows Required

  • OutlinePlanner
  • createSections
  • SectionsWriter
  • Editor
  • MetaInfo
  • Tags Agent
  • ImagePrompt (if enabled)

3. Dynamic Inputs

  • Categories fetched via WP REST API and shown in the form
  • Tags generated and updated dynamically by Tags Agent
  • Excerpt automatically created and updated in WordPress
  • Image creation can be toggled (true / false)

📸 Optional Image Pipeline

If enabled:

  1. Generate image prompt and alt text
  2. Create realistic cover image (1024x1024)
  3. Resize and upload image to WordPress
  4. Set image metadata and assign featured image

💡 Notes

  • Workflow is production-ready — just copy-paste into n8n as a single workflow.
  • GPT-5 prompts embedded in each agent ensure high-quality, context-aware output
  • All HTML, JSON, excerpts, and tags are validated before publication
  • Modular sub-workflows allow isolated testing and debugging
  • Workflow supports legal accuracy, SEO performance, and dynamic web data responsiveness