Automate WordPress Article Drafts with n8n & OpenAI

Discover how this unique n8n workflow leverages OpenAI and WordPress to automate creating SEO-friendly article drafts effortlessly. It streamlines content creation by generating titles, chapters, and featured images, saving hours of manual work.
formTrigger
n8-nodes-openAi
wordpress
+7
Workflow Identifier: 1191
NODES in Use: formTrigger, set, openAi, if, splitOut, merge, code, wordpress, httpRequest, form

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow helps create WordPress article drafts fast from keywords.
The main problem solved is saving hours of manual work writing and organizing articles with SEO content.
The result is a full draft with title, chapters, intro, conclusion, and a featured image ready in WordPress.


Who should use this workflow

This is good for content managers, small business owners, and anyone who needs quick SEO articles.
It works well even if English is not your first language or if coding is new.


Tools and services used

  • OpenAI GPT-4o Mini: Generates article structure and chapter texts.
  • OpenAI DALL·E: Creates a photographic featured image.
  • WordPress REST API: Posts draft articles and uploads media.
  • n8n Workflow Automation: Connects and automates all steps.


Inputs, processing steps, and output

Inputs

  • User gives keywords, number of chapters, and max word count through a form.
  • API keys for OpenAI and WordPress must be configured.

Processing steps

  • Step 1: User input is collected with Form Trigger and mapped using the Set node.
  • Step 2: OpenAI generates the article title, subtitle, intro, conclusion, chapter titles, prompts, and an image prompt.
  • Step 3: A check ensures all needed data fields are present. If not, user retry message shows.
  • Step 4: Chapters array is split into single items.
  • Step 5: Each chapter prompt is sent to OpenAI to create rich, SEO-friendly chapter text.
  • Step 6: Chapter texts are merged back in order.
  • Step 7: A Code node joins the whole article in HTML format with styling.
  • Step 8: The post draft is created in WordPress with the generated content and title.
  • Step 9: OpenAI DALL·E generates a cover image using the AI image prompt.
  • Step 10: The image is uploaded to WordPress media library.
  • Step 11: WordPress post updated to set the featured image from uploaded media.
  • Step 12: User gets a confirmation message that draft is created.

Output

A WordPress draft post with AI-written article and a related featured image.


Beginner step-by-step: How to use this workflow in n8n

Importing the workflow

  1. Download the workflow file by clicking the Download button on this page.
  2. Open your n8n editor.
  3. Go to the main menu, choose “Import from File,” and select the downloaded file.

Configuring credentials

  1. Add or update your OpenAI API Key in the OpenAI nodes.
  2. Add or update your WordPress site’s API credentials in the WordPress and HTTP Request nodes.
  3. Make sure the WordPress URL in the Set node called Settings is your site’s base URL like https://yourwordpresssite.com/.

Testing the workflow

  1. Trigger the workflow by opening the Webhook node URL from the Form Trigger node in a browser or tool.
  2. Fill the form with keywords, number of chapters, and max words.
  3. Check the workflow runs fully and posts a draft on WordPress.

Activating for production

  1. In n8n, change the workflow status from “Draft” to “Active.”
  2. Monitor executions via n8n dashboard for errors.
  3. Keep API keys updated and check usage limits.

Additional note

To use self-host n8n, import and activate workflow on your server for better control.


Customizations

  • Change WordPress site URL in the Settings node.
  • Switch OpenAI model for text generation in respective OpenAI nodes.
  • Increase or reduce chapters and max words via the Form Trigger node.
  • Change image style by editing the DALL·E prompt or image settings.
  • To auto-publish articles, set the post status from “draft” to “publish” in the WordPress node.


Edge cases and common failures

  • OpenAI returns incomplete data: Could be limit reached or prompt issue. Add checks to halt workflow on missing fields.
  • WordPress authentication fails: Credentials may be wrong or access denied. Recheck API key and user rights.
  • Featured image not attached: Media ID may be wrong or HTTP request badly formed. Confirm upload success and correct media ID.


Pre-Production checklist

  • Ensure the webhook URL accepts inputs.
  • Test OpenAI connection and responses.
  • Validate WordPress API access and permissions.
  • Run a sample article generation test.
  • Confirm cover image displays on draft.
  • Backup the workflow before changes.


Summary of results

✓ Saves several hours of content creation time
✓ Creates SEO-friendly article drafts automatically
✓ Builds full article with structured chapters and proper formatting
Generates featured images matching the article theme
✓ Posts finished drafts to WordPress for easy publishing

→ Faster blog post turnaround
→ Reduced manual writing and image searching effort
→ Improved content consistency and SEO quality


=Write the title, the subtitle, the chapters details, the introduction, the conclusions, and an image prompt for a SEO-friendly article about these topics:
{{ $json.keywords }}.

Instructions:
- Place the article title in a JSON field called `title`
- Place the subtitle in a JSON field called `subtitle`
- Place the introduction in a JSON field called `introduction`
- The introduction should be ~60 words
- Place the conclusions in a JSON field called `conclusions`
- The conclusions should be ~60 words
- Use the conclusions to summarize and conclude
- Provide {{ $json.chapters.toString() }} chapters with `title` and `prompt` fields each
- Chapters should logically flow and not repeat concepts
- Use HTML formatting with bold, italic, and lists only
- Search Wikipedia to verify info
- Do not mention Wikipedia explicitly

Frequently Asked Questions

User inputs keywords, number of chapters, and max word count via a form triggered by the Form Trigger node.
OpenAI GPT-4o Mini generates article text while OpenAI DALL·E creates the featured images.
Active WordPress REST API with valid API credentials that allow post creation and media upload.
Download the workflow file, import it into n8n, add API keys and WordPress URL, test the workflow, then activate it for production.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free