Back to Templates

End-to-End Blog Generation for WordPress with LLM Agents & Image Creation

Last update

Last update a day ago

Share


🧠 n8n Blog Automation Workflow

Automate end-to-end blog post generation for WordPress using LLM agents, structured orchestration, and image generation.


📌 Overview

This workflow auto-generates a complete WordPress blog post using only a few inputs (keywords, number of sections, style, etc.). It orchestrates multiple AI agents to:

  • Generate topic-specific outlines
  • Write section content
  • Edit and polish the final post
  • Create metadata
  • Optionally generate and upload a featured image
  • Publish the post to WordPress in draft status

🛠 Workflow Components

🔁 Trigger

  • Form Trigger: A visual form where users input:
    • Keywords
    • Word count
    • Number of sections
    • Writing style
    • Website URL
    • Whether to generate a featured image

🧠 Orchestration Agent

A centralized LangChain agent that coordinates sub-agents:

  1. OutlinePlanner – SEO-based Table of Contents generator
  2. createSections – Breaks ToC into blog sections
  3. SectionsWriter – Writes each section’s content with citations
  4. Editor – Refines and assembles sections into a full HTML post
  5. MetaInfo – Generates post title, slug, and description
  6. ImagePrompt – (optional) AI image prompt and alt text generator

✍️ Writing Flow

  1. GetOnlineInfo: Uses OpenRouter to find current Q&A about the keyword
  2. OutlinePlanner: Generates a structured blog ToC
  3. createSections: Converts ToC to blog section structure
  4. SectionsWriter: Writes SEO content with sources
  5. Editor: Assembles and edits the full blog HTML
  6. MetaInfo: Titles, slugs, meta description
  7. ImagePrompt + Image Generator (if enabled):
    • Prompt + alt text
    • Realistic image using OpenAI
    • Upload to WordPress media library
  8. Final check: If post is marked as ready, it's published

✅ Output Format

{
  "toc": "table of contents",
  "post_html": "<blog post HTML>",
  "meta_data": {
    "title": "...",
    "slug": "...",
    "description": "..."
  },
  "image_data": {
    "image_prompt": "...",
    "alt_text": "..."
  },
  "ready": true
}

🌐 WordPress Integration

The final blog post and featured image are posted to WordPress using authenticated API calls:

  • /wp-json/wp/v2/posts
  • /wp-json/wp/v2/media

Posts are published as drafts, with optional featured image and metadata.


🧩 Setup Instructions

1. Required Credentials

  • WordPress API credential
  • OpenAI API credential
  • (Optional) OpenRouter API credential

2. Sub-Workflows (Tool Agents)

Create the following sub-workflows:

  • OutlinePlanner
  • createSections
  • SectionsWriter
  • Editor
  • MetaInfo
  • ImagePrompt

Ensure each workflow accepts a query field as JSON input.

3. Trigger Form

Configure the FormTrigger node with appropriate fields:

  • KeyWords
  • Word Count
  • Number of Sections
  • Generate a Featured Image (dropdown: true/false)
  • Writing Style
  • Website URL

4. Enable LLM Tools

Assign model nodes (e.g., GPT-4.1, GPT-4o-mini) to the respective LangChain agents.


📸 Image Pipeline (Optional)

If "Generate a featured image" is set to true, the following steps occur:

  • ImagePrompt: Defines a realistic prompt
  • Generate Image: Uses OpenAI API to generate an image
  • Resize Image (optional)
  • Upload Image to WP
  • Update Meta Info
  • Set Featured Image

💡 Notes

  • All outputs are valid JSON and HTML
  • All sources are cited with clickable HTML anchor tags
  • Workflow is modular: each tool-agent can be debugged independently
  • Blog is styled for SEO, legal accuracy, and professional tone

📷 Screenshot Suggestion

  • Add a screenshot of the main orchestration flow + each tool subworkflow for clarity.