Overview
This lesson is part of the n8n AI Automation - Zero to Hero course, Section: 6. AI-Powered Workflows.
Watch the video above for the full tutorial, or read the written guide below.
What is the AI Blog Writer workflow in n8n?
The AI Blog Writer workflow in n8n connects a Google Sheet of content topics to OpenAI, producing an SEO-optimized blog post first, then using that post as input to generate Twitter, LinkedIn, Facebook, and YouTube script content. A status column in the source sheet tracks which topics are pending, and a separate AI Prompts sheet holds all platform-specific system and user prompts, keeping the workflow dynamic without hardcoded text.
How to build the AI Blog Writer workflow in n8n
The Google Sheets trigger fires on row added and runs every hour, preventing the workflow from publishing too fast. A second Google Sheets node fetches only the first row where the status column equals "pending," returning one topic at a time with its audience, tone, word count, domain/niche, and status fields. A manual trigger node pairs with this fetch step so you can test without waiting for a new sheet row.
The AI Prompts sheet stores five rows, one per platform: WordPress, Twitter, LinkedIn, Facebook, and YouTube. Each row holds a system prompt and a user prompt with double-curly-brace placeholders such as {{topic}}, {{word_count}}, {{tone}}, and {{domain_niche}}. A code node, generated by n8n's built-in Ask AI tab from a plain-English instruction, loops over all five prompt rows and replaces every placeholder with the matching value from the fetched topic row. Adding a new platform like TikTok only requires a new row in the AI Prompts sheet, not a new node in the canvas.
An IF node checks whether the content platform equals "WordPress" and routes that branch to an OpenAI node configured with the dynamic system and user prompts. The model returns a full HTML blog post wrapped in triple-backtick fences, so a Set Fields node strips those fences with a replaceAll expression before passing clean HTML to the WordPress node, which saves the post as a draft. The false branch from the IF node handles all social platforms, where each prompt receives the completed blog post as input rather than the raw topic title, keeping blog and social content consistent.
Key Takeaways
- The AI Prompts Google Sheet stores system and user prompts for all five platforms (WordPress, Twitter, LinkedIn, Facebook, YouTube), making the workflow extensible without adding or rewiring nodes.
- Double-curly-brace placeholders like
{{topic}}and{{word_count}}in prompt text get replaced at runtime by a code node generated via n8n's Ask AI tab from a plain-English description, so no manual coding is required. - The IF node branches on content platform equals "WordPress" so the blog post is generated first; every social media prompt then uses that completed blog post as its input, not the original topic title.
- The WordPress node saves posts in draft mode, giving you an editing checkpoint before anything goes live, because AI output needs human review for hallucinations and tone mismatches before publishing.
- The status column in the topics sheet controls which rows the workflow processes, letting you queue content for multiple blogs or niches in a single sheet by adding columns like blog name.
Related Lessons
- Lesson 36: AI Automation with n8n: Supercharge Your Workflows with OpenAI
- Lesson 37: AI Powered Email Assistant: Automate Your Inbox with n8n & OpenAI
- Lesson 39: AI Resume Screening
Next Steps
Continue your n8n journey with the full n8n AI Automation - Zero to Hero course.