← All N8N workflows
AI & researchAgentCodeHTTP RequestOpenAI Chat ModelMerge

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.

Workflow preview
TriggerSchedule TriggerSchedule TriggerAI & modelsOpenAI Chat ModelOpenAI Chat ModelWeb / APIDownload ImageHTTP RequestCodePrepare Post JSONCodeTransformMergeMergeAI & modelsOpenAI Chat Model1OpenAI Chat ModelWeb / APILoad CategoriesHTTP RequestCodeCategory FilterCodeData storeSelecting recentPostgresCodePicks Less UsedCodeData store10 latest headlinesPostgresCodeNew article titleCodeAI & modelsAI Agent SEO HeadingsAgentAI & modelsAI Agent SEO writerAgentTransformMerge headingMergeCodeCombines full post metaCodeData storeUpdating posts DBPostgresCodeExtracting outputCodeCodePlaceholder creatorCodeWeb / APIMedia Upload to WPHTTP RequestWeb / APIPost to WPHTTP RequestRoutingNo Operation, donothingNo OpTransformConfigEdit Fields

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.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Schedule TriggerTriggerSchedule TriggerSee node parameters
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
Download ImageWeb / APIHTTP RequestSee node parameters
Prepare Post JSONCodeCodeSee node parameters
MergeTransformMergeSee node parameters
OpenAI Chat Model1AI & modelsOpenAI Chat ModelSee node parameters
Load CategoriesWeb / APIHTTP RequestSee node parameters
Category FilterCodeCodeSee node parameters
Selecting recentData storePostgresexecuteQuery
Picks Less UsedCodeCodeSee node parameters
10 latest headlinesData storePostgresexecuteQuery
New article titleCodeCodeSee node parameters
AI Agent SEO HeadingsAI & modelsAgentSee node parameters
AI Agent SEO writerAI & modelsAgentSee node parameters
Merge headingTransformMergeSee node parameters
Combines full post metaCodeCodeSee node parameters
Updating posts DBData storePostgresupsert
Extracting outputCodeCodeSee node parameters
Placeholder creatorCodeCodeSee node parameters
Media Upload to WPWeb / APIHTTP RequestPOST
Post to WPWeb / APIHTTP RequestPOST
No Operation, do nothingRoutingNo OpSee node parameters
ConfigTransformEdit FieldsSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. 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

  • openAiApi
  • postgres
  • wordpressApi

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 /posts and 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_CREDENTIAL is configured
  • DB user has SELECT rights 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.

More in AI & research