Auto WordPress Blog Generator (GPT + Postgres + WP Media)
Configured with Agent, HTTP Request, OpenAI Chat Model, Postgres, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Trigger
- AI & models
- Web / API
- Code
- Transform
- Data store
- Routing
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Schedule Trigger | Trigger | Schedule Trigger | See node parameters |
| OpenAI Chat Model | AI & models | OpenAI Chat Model | See node parameters |
| Download Image | Web / API | HTTP Request | See node parameters |
| Prepare Post JSON | Code | Code | See node parameters |
| Merge | Transform | Merge | See node parameters |
| OpenAI Chat Model1 | AI & models | OpenAI Chat Model | See node parameters |
| Load Categories | Web / API | HTTP Request | See node parameters |
| Category Filter | Code | Code | See node parameters |
| Selecting recent | Data store | Postgres | executeQuery |
| Picks Less Used | Code | Code | See node parameters |
| 10 latest headlines | Data store | Postgres | executeQuery |
| New article title | Code | Code | See node parameters |
| AI Agent SEO Headings | AI & models | Agent | See node parameters |
| AI Agent SEO writer | AI & models | Agent | See node parameters |
| Merge heading | Transform | Merge | See node parameters |
| Combines full post meta | Code | Code | See node parameters |
| Updating posts DB | Data store | Postgres | upsert |
| Extracting output | Code | Code | See node parameters |
| Placeholder creator | Code | Code | See node parameters |
| Media Upload to WP | Web / API | HTTP Request | POST |
| Post to WP | Web / API | HTTP Request | POST |
| No Operation, do nothing | Routing | No Op | See node parameters |
| Config | Transform | Edit Fields | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
openAiApipostgreswordpressApi
Workflow notes
🤖 WordPress Blog Automation Workflow
🤖 WordPress Blog Automation Workflow
🛠 SETUP (do once before running the flow)
1 · DOMAIN
Add one variable anywhere before the workflow starts (via Set node, .env, or instance config):
DOMAIN=https://your-wordpress-site.com
This will be used in all WordPress REST API calls.
2 · CREDENTIALS (create in n8n → Credentials)
| Credential Name | Purpose | Minimum Scope |
|-----------------|---------|---------------|
| YOUR_WORDPRESS_CREDENTIAL | WordPress API | POST /media, POST /posts |
| YOUR_POSTGRES_CREDENTIAL | PostgreSQL access for used categories | DB + table created in step 3 |
| YOUR_OPENAI_CREDENTIAL | OpenAI key for GPT | GPT-4-mini or better |
🧠 Keep the names exactly — the workflow references them directly.
3 · POSTGRESQL (one-time bootstrap)
🖥️ Terminal method (fastest — paste into sudo -u postgres psql)
-- 3-A · Create database and user
CREATE DATABASE n8n_blog;
CREATE USER n8n_writer WITH PASSWORD 'S3cur3-Pa55';
GRANT ALL PRIVILEGES ON DATABASE n8n_blog TO n8n_writer;
\c n8n_blog n8n_writer -- Reconnect to DB as the new user
-- 3-B · Create the tracking table
CREATE TABLE IF NOT EXISTS public.used_categories (
category_id INTEGER PRIMARY KEY,
name TEXT,
description TEXT,
title TEXT,
used_at TIMESTAMPTZ
);
GRANT INSERT, UPDATE, SELECT ON public.used_categories TO n8n_writer;
🔗 Then configure the credential in n8n
Name: YOUR_POSTGRES_CREDENTIAL
Host: 127.0.0.1
Port: 5432
Database: n8n_blog
User: n8n_writer
Password: S3cur3-Pa55
Schema: public
💡 No terminal access?
Create a temporary Postgres → Execute Query node with the same SQL, run once, then delete it.
4 · FIRST TEST
Run the first 3–5 nodes manually to verify:
- ✅ WordPress auth works
- ✅ DB connection + writing works
- ✅ GPT responds as expected
Once confirmed, enable the Schedule Trigger to automate.
✅ WHAT THIS WORKFLOW DOES
- Loads all WP categories and filters out excluded ones
- Picks the least-used category from your DB
- Generates a unique, well-structured WP article using GPT (TOC, blocks, CTA)
- Generates a cover image and uploads it to
/media - Publishes the post to
/postsand updates usage in your PostgreSQL DB
Sticky Note1
⏰ Triggers this workflow every few hours.
Sticky Note2
📥 Loads all WordPress categories.
Sticky Note3
🧹 Filters out excluded category IDs.
Choose them yourself, some categories are not for AI Agent, like reviews or same
Sticky Note4
🗃 Loads recently used categories from DB.
Sticky Note5
🎯 Picks least-used category for next post.
Sticky Note6
📄 Loads 10 latest article titles for the selected category.
Sticky Note7
🧠 Generates a unique article title with GPT.
Sticky Note8
🧾 Prepares the new article title.
Sticky Note9
🔀 Merges category + title data.
Sticky Note10
📦 Combines all post metadata into one object.
Sticky Note11
📝 Saves used category and title to DB.
Sticky Note12
✍️ Writes full WordPress-style HTML article.
Sticky Note13
🧾 Extracts content block from AI output.
Sticky Note14
🖼 Prepares a placeholder cover image URL.
Sticky Note15
⬇️ Downloads the cover image.
Sticky Note16
📤 Uploads image to WordPress media.
Sticky Note17
🔗 Merges image + content + category info.
Sticky Note18
📬 Prepares final JSON body for the WP post.
Sticky Note19
🚀 Publishes post to your WordPress site.
Sticky Note20
Make sure:
- Your WordPress site allows public access to
/wp-json/wp/v2/categories - You have at least 1 category created
- No security plugin (like Wordfence) is blocking REST API
No credential needed for public category fetch.
Sticky Note21
Make sure:
- You've created the table (see setup note)
- Credential
YOUR_POSTGRES_CREDENTIALis configured - DB user has
SELECTrights on the table
Tip: This selects the least recently used category for the next post.
Sticky Note22
! Set your WordPress domain inside the “Config” Set node.
Auto WordPress Blog Generator (GPT + Postgres + WP Media)
Auto WordPress Blog Generator (GPT + Postgres + WP Media)
Purpose and structure
This folder contains the Auto WordPress Blog Generator (GPT + Postgres + WP Media) workflow. Its executable nodes use agent, code, httpRequest, lmChatOpenAi, merge, noOp, postgres, scheduleTrigger, set. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Schedule Trigger
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Postgres/0263_Postgres_Code_Automation_Webhook.json MIT; preserve source notices.