GPT WordPress blog generator with Postgres in n8n
This n8n workflow writes and publishes WordPress blog posts on a schedule using GPT, with a Postgres table to remember what was already covered. It is for site owners who want regular posts with a featured image and the right category set automatically.
What it does
The schedule trigger loads your WordPress categories, checks recent topics in PostgreSQL, has the OpenAI model draft the article, downloads an image, uploads it to WP Media and posts the result as JSON through the WordPress REST API.
How to use it
Set a DOMAIN variable before the flow starts, then create the WordPress, OpenAI and Postgres credentials named in the setup table.
Requirements and limits
The WordPress credential needs permission to create posts and upload media.
More in PostgreSQL and the n8n workflow library.
Full text
Front matter
name: Auto WordPress Blog Generator (GPT + Postgres + WP Media)
description: Triggered on a schedule. Connects Code, HTTP request, PostgreSQL, Schedule. # 🤖 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={{ $env.WEBHOOK_URL }} ``` 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 /
category: Automation
kind: Workflow
software: Code|HTTP request|PostgreSQL|ScheduleAuto WordPress Blog Generator (GPT + Postgres + WP Media)
Triggered on a schedule. Connects Code, HTTP request, PostgreSQL, Schedule. # 🤖 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={{ $env.WEBHOOK_URL }}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 / |
Steps
- Schedule Trigger (scheduleTrigger)
- OpenAI Chat Model (noOp)
- Download Image (httpRequest)
- Prepare Post JSON (code)
- Merge (merge)
- OpenAI Chat Model1 (noOp)
- Sticky Note (stickyNote)
- Sticky Note1 (stickyNote)
- Sticky Note2 (stickyNote)
- Sticky Note3 (stickyNote)
- Sticky Note4 (stickyNote)
- Sticky Note5 (stickyNote)
- Sticky Note6 (stickyNote)
- Sticky Note7 (stickyNote)
- Sticky Note8 (stickyNote)
- Sticky Note9 (stickyNote)
- Sticky Note10 (stickyNote)
- Sticky Note11 (stickyNote)
- Sticky Note12 (stickyNote)
- Sticky Note13 (stickyNote)
- Sticky Note14 (stickyNote)
- Sticky Note15 (stickyNote)
- Sticky Note16 (stickyNote)
- Sticky Note17 (stickyNote)
- Sticky Note18 (stickyNote)
- Sticky Note19 (stickyNote)
- Sticky Note20 (stickyNote)
- Sticky Note21 (stickyNote)
- Load Categories (httpRequest)
- Category Filter (code)
- Selecting recent (postgres)
- Picks Less Used (code)
- 10 latest headlines (postgres)
- New article title (code)
- AI Agent SEO Headings (noOp)
- AI Agent SEO writer (noOp)
- Merge heading (merge)
- Combines full post meta (code)
- Updating posts DB (postgres)
- Extracting output (code)
Import
Download the JSON from the GitHub source and import it in n8n (Workflows, Import from file).
Source and license
Source: https://github.com/Zie619/n8n-workflows/blob/main/Postgres/0263_Postgres_Code_Automation_Webhook.md
Author: Zie619, n8n workflow collection. License: MIT.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The n8n workflow library holds 1,814 entries. Members can search all of them by meaning and read every one in full.