🧠 n8n Blog Automation Workflow
🧠 n8n Blog Automation Workflow
End-to-end automation of SEO-optimized WordPress blog post creation using LLM agents, real-time search, intelligent content structuring, and optional image generation.
📌 Overview
This workflow accepts basic blog post parameters from a form, dynamically fetches WordPress categories, and generates a complete article through orchestrated AI agents. It includes:
- Real-time online data gathering
- Structured outline generation
- Section planning and writing
- SEO-enhanced editing
- Metadata and image prompt creation
- Category selection and post publishing
🔁 Trigger
-
Form Trigger: Collects user inputs:
- Keywords
- Word count
- Number of sections
- Writing style
- Website URL
- Generate featured image? (yes/no)
🧠 Orchestration Agent
Central LangChain agent that manages the full multi-step pipeline. It calls these specialized agents:
- GetOnlineInfo – Uses OpenRouter for current Q&A and search insights.
- OutlinePlanner – Creates SEO-structured Table of Contents.
- createSections – Breaks ToC into detailed sections with short descriptions.
- SectionsWriter – Writes legally sound, citation-rich, expert content.
- Editor – Refines, formats, and assembles all content into publish-ready HTML.
- MetaInfo – Generates title, slug, and meta description, select the category.
- ImagePrompt (optional) – Generates prompt and alt text for AI image generation.
Each agent is invoked only once, in strict sequence, using query
-wrapped JSON input.
✍️ Writing Flow
- GetOnlineInfo: Gathers Q&A data from web.
- OutlinePlanner: Builds a logical, SEO-driven structure.
- createSections: Converts ToC into section objects.
- SectionsWriter: Writes expert content per section.
- Editor: Compiles and refines the article.
- MetaInfo: Produces metadata (title, slug, description, category id).
- ImagePrompt: Creates an image prompt and alt text (if enabled).
- Final Check: If content is marked ready, post proceeds to publication.
✅ Output Format
{
"toc": "Table of Contents",
"post_html": "<final HTML content>",
"meta_data": {
"title": "...",
"slug": "...",
"description": "..."
},
"image_data": {
"image_prompt": "...",
"alt_text": "..."
},
"ready": true
}
🌐 WordPress Integration
- Uses authenticated API to create and update:
- Posts (
/wp-json/wp/v2/posts
) - Media (
/wp-json/wp/v2/media
)
- Posts (
- Automatically assigns selected category and random author.
- Posts are published in draft mode by default.
- Sets featured image metadata and linkage if image is generated.
🧩 Setup Instructions
1. Required Credentials
- WordPress API credentials
- OpenAI API key
- OpenRouter API key (optional)
2. Sub-Workflows Required
OutlinePlanner
createSections
SectionsWriter
Editor
MetaInfo
-
ImagePrompt
(if enabled)
Each must support input via {"query": "<text>"}
.
3. Dynamic Inputs
- Categories are fetched via WP REST API and shown in the form.
- Image creation can be toggled (true/false).
📸 Optional Image Pipeline
If enabled, this runs:
- Generate image prompt and alt text
- Create realistic cover image (1024x1024)
- Resize and upload image to WordPress
- Set image metadata and assign featured image
💡 Notes
- All data outputs (HTML, JSON) are structured and valid.
- Source links are embedded via HTML anchor tags.
- Modular design supports debugging each tool-agent.
- Styled for clarity, SEO, and legal accuracy.
- Responsive to live content needs via web search.
🔹 This workflow automates WordPress blog creation using AI. It takes user input from a form, fetches the category list, and runs agents to generate SEO content, metadata, and optionally a featured image. The final draft is posted to WordPress, ready for review.