Auto WordPress Blog Generator with GPT and PostgreSQL
High-Level Summary
This workflow automates the entire process of generating and publishing unique, SEO-optimized blog posts to a WordPress site. It intelligently selects the least-used category from your WordPress site, generates a unique article title and full WordPress-block-formatted content using OpenAI's GPT models, creates a placeholder cover image, uploads it to WordPress media, and publishes the post — all without manual intervention. A PostgreSQL database tracks which categories have been used and when, ensuring content is evenly distributed across categories over time.
This is ideal for content marketers, bloggers, or site owners who want to maintain a consistent publishing schedule with fresh, relevant content while minimizing repetitive manual work.
Step-by-Step Node Breakdown
- Schedule Trigger (No auth) — Runs the workflow automatically on a recurring schedule. Configured to trigger every few hours (interval-based on hours).
- Config (No auth) — A Set node that defines the WordPress site domain. You must update the
domainvalue to your actual WordPress site URL (e.g.,https://yourdomain.com). - Load Categories (No auth) — HTTP Request node that fetches all categories from your WordPress REST API at
/wp-json/wp/v2/categories?per_page=100. No authentication is required if your WordPress site allows public access to categories. - Category Filter (No auth) — Code node that filters out excluded category IDs (e.g., 1, 11, 12, 13, 15, 17, 18, 36, 37, 38, 39). You can customize this list to skip categories you don't want AI to write for (e.g., reviews, about pages).
- Selecting recent (PostgreSQL credential:
YOUR_POSTGRES_CREDENTIAL) — Executes a SQL query on your PostgreSQL database to select all category IDs from theused_categoriestable, ordered by the least recently used. This helps pick the category that hasn't been used in the longest time. - Picks Less Used (No auth) — Code node that compares the list of available categories (from step 4) with the usage history (from step 5) and selects the category with the oldest last-used timestamp. If no history exists, it picks the first available category.
- 10 latest headlines (PostgreSQL credential:
YOUR_POSTGRES_CREDENTIAL) — Queries theused_categoriestable for the last 10 article titles/descriptions written for the selected category. This data is fed to GPT to avoid duplicate topics. - AI Agent SEO Headings (OpenAI credential:
YOUR_OPENAI_CREDENTIAL) — Uses an OpenAI Chat Model (GPT-4.1-mini) to generate a unique, clickable article title based on the selected category name, description, and existing titles. The prompt instructs the model to output only the title. - New article title (No auth) — Code node that extracts the generated title from the AI output and formats it for downstream nodes.
- Merge heading (No auth) — Merge node that combines the selected category data (from step 6) with the new article title (from step 9) into a single data stream.
- Combines full post meta (No auth) — Code node that merges all incoming JSON objects into one unified object containing category info, title, and other metadata.
- Updating posts DB (PostgreSQL credential:
YOUR_POSTGRES_CREDENTIAL) — Upserts a record into theused_categoriestable with the category ID, name, title, description, and current timestamp. This tracks which category was used and when. - AI Agent SEO writer (OpenAI credential:
YOUR_OPENAI_CREDENTIAL) — Uses a second OpenAI Chat Model (GPT-4.1) to generate the full blog post content in native WordPress HTML block format (including paragraphs, headings, lists, table of contents, conclusion, and a call-to-action). The prompt includes the category name, description, and site link. - Extracting output (No auth) — Code node that extracts the
outputfield from the AI response and renames it tocontentfor WordPress compatibility. - Placeholder creator (No auth) — Code node that generates a placeholder image URL using
placehold.cowith the category name as text. This serves as a simple cover image. - Download Image (No auth) — HTTP Request node that downloads the placeholder image from the generated URL. The response is saved as a file (
imagedownloaded). - Media Upload to WP (WordPress API credential:
YOUR_WORDPRESS_CREDENTIAL) — HTTP Request node that uploads the downloaded image to WordPress media library viaPOST /wp-json/wp/v2/media. It uses Basic Auth or Application Password (via thewordpressApicredential type). Headers includeContent-DispositionandContent-Type. - Merge (No auth) — Merge node with 3 inputs that combines the content (from step 14), the uploaded media ID (from step 17), and the category/title data (from step 12) into a single stream.
- Prepare Post JSON (No auth) — Code node that inspects all incoming items and constructs the final JSON payload for the WordPress post, including title, content, status (
publish), categories array, andfeatured_mediaID. - Post to WP (WordPress API credential:
YOUR_WORDPRESS_CREDENTIAL) — HTTP Request node that publishes the post to WordPress viaPOST /wp-json/wp/v2/posts. It sends the prepared JSON body with title, content, status, featured_media, and categories. - No Operation, do nothing (No auth) — A terminal node that marks the successful end of the workflow.
Setup Instructions
To use this workflow, you need the following accounts and services:
- WordPress Site — A self-hosted WordPress site with REST API enabled. Ensure no security plugin (like Wordfence) blocks API access.
- OpenAI Account — An OpenAI API key with access to GPT-4 models (GPT-4.1-mini and GPT-4.1). Create a credential in n8n named
YOUR_OPENAI_CREDENTIAL. - PostgreSQL Database — A PostgreSQL database (local or cloud) with a table named
used_categories. Create a credential in n8n namedYOUR_POSTGRES_CREDENTIALwith host, port, database name, user, password, and schema (public). - WordPress API Credential — In n8n, create a credential of type "WordPress API" named
YOUR_WORDPRESS_CREDENTIAL. Use your WordPress username and Application Password (generated in Users → Profile → Application Passwords).
One-time database setup: Run the following SQL to create the required table:
CREATE TABLE IF NOT EXISTS public.used_categories (
category_id INTEGER PRIMARY KEY,
name TEXT,
description TEXT,
title TEXT,
used_at TIMESTAMPTZ
);
Important: Update the Config node with your actual WordPress domain (e.g., https://yourdomain.com). Also, customize the excluded category IDs in the Category Filter node to match your site.
Use Cases and Variations
- Content Marketing Automation — Schedule this workflow to run daily or weekly to automatically publish fresh blog content across multiple categories, keeping your site active and SEO-friendly.
- Multi-Author Blogs — Adapt the workflow to assign different GPT personas or tones for different categories (e.g., technical vs. lifestyle).
- Newsletter Integration — After publishing, add a node to send an email notification or push the new post to a Slack channel or mailing list.
- Image Enhancement — Replace the placeholder image generator with an AI image generation node (e.g., DALL-E or Stable Diffusion) to create unique, relevant cover images.
- Multi-Language Support — Modify the GPT prompts to generate content in different languages by adjusting the language instruction in the AI Agent nodes.
- Review Before Publishing — Change the post status from
publishtodraftin thePost to WPnode, so you can manually review and approve posts before they go live.
Workflow JSON
{
"id": "17j2efAe10uXRc4p",
"meta": {
"instanceId": "95e5c2dbf167bd62714d47d959f677d4c29b5fcbb7d183f4fe2396c33badeac6",
"templateCredsSetupCompleted": true
},
"name": "Auto WordPress Blog Generator (GPT + Postgres + WP Media)",
"tags": [
{
"id": "k8Hqq1bbCQoesJjj",
"name": "Wordpress",
"createdAt": "2025-02-26T04:04:38.319Z",
"updatedAt": "2025-02-26T04:04:38.319Z"
}
],
"nodes": [
{
"id": "f71a8a34-5d88-48b0-bf56-44c95d970abd",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1120,
-560
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"triggerAtMinute": {}
}
]
}
},
"typeVersion": 1.2
},
{
"id": "8ce11fcd-806c-44ea-aa5f-015599eacc98",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2060,
-20
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-2025-04-14",
"cachedResultName": "gpt-4.1-2025-04-14"
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
AI LinkedIn Content Creator with Perplexity Research & Auto-Posting
AI-Powered LinkedIn Content Automation Workflow Overview This workflow automates the entire LinkedIn content lifecycle — from research and ideation to image generation and scheduled posting. It uses Perplexity AI for topic research, an Anthropic Claude model as the content strategist, and OpenAI's image generation model to create branded visuals. The workflow runs on two separate schedules: one for content creation (daily) and one for publishing (twice weekly). It stores all posts in a Google Sheet for review before they go live, giving you full control over what gets published. This is ideal for founders, marketers, and content creators who want to maintain a consistent LinkedIn presence without spending hours writing, designing, and scheduling posts manually. The system learns from past content stored in Google Sheets and uses AI to generate fresh, on-brand posts that resonate with your target audience. Node-by-Node Breakdown Content Creation Pipeline (Runs Daily at 5 AM) Schedule () — No auth. Triggers the content creation workflow daily at 5:00 AM. This is the starting point for generating new post ideas. Get Past Ideas () — OAuth2. Reads all rows from the "LinkedIn Posts" sheet in the Google Sheet "AI Content Database". This provides the AI with context about previously generated posts to avoid repetition. Join Ideas () — No auth. A JavaScript code node that concatenates all past post ideas into a single text string, making it easy for the AI to reference them. LinkedIn Creator Agent () — No auth (uses connected models). This is the core AI agent that generates LinkedIn post content. It uses: - Anthropic Chat Model () — API Key auth. Uses Claude 3.7 Sonnet as the language model for content generation. - Perplexity Research () — API Key auth. A sub-workflow that uses Perplexity AI to research current topics and trends. - Structured Output Parser () — No auth. Ensures the AI output follows a structured JSON format with fields: , , and . Image Style () — OAuth2. Downloads a reference image from Google Drive that serves as the style guide for generating new images. OpenAI Image1 () — Header Auth (HTTP Header Auth). Sends a POST request to OpenAI's image generation API (gpt-image-1 model) with the reference image and a prompt describing the desired image for the LinkedIn post. Convert to File () — No auth. Converts the base64 image data from OpenAI's response into a binary file for saving to Google Drive. Save Image () — OAuth2. Uploads the generated image to a specific folder ("LinkedIn AI Posts") in Google Drive, naming it after the post title. Save Post () — OAuth2. Appends a new row to the "LinkedIn Posts" sheet with the post text, description, image URL, and status set to "review". Publishing Pipeline (Runs Every 3 Days at 2 PM) Schedule 2 () — No auth. Triggers the publishing workflow every 3 days at 2:00 PM. Get Ready Posts () — OAuth2. Filters the Google Sheet for rows where the status column equals "ready", retrieving posts that have been approved for publishing. Pick One () — No auth. Limits the output to a single post (first row) from the filtered results. Download Image () — OAuth2. Downloads the image associated with the selected post from Google Drive using the image URL stored in the sheet. Publish Post () — OAuth2. Publishes the post to LinkedIn with the text content and attached image, set to public visibility. Update Status () — OAuth2. Updates the status of the published post from "ready" to "posted" in the Google Sheet, matching by the "about" column. Setup Instructions Required Accounts & Services Google Account — For Google Sheets and Google Drive access. You'll need to create a Google Cloud Project and enable the Sheets and Drive APIs, then create OAuth2 credentials. Anthropic Account — Sign up at console.anthropic.com to get an API key for Claude 3.7 Sonnet. Perplexity AI Account — Sign up at perplexity.ai and obtain an API key for research capabilities. OpenAI Account — Sign up at platform.openai.com and get an API key for image generation. LinkedIn Account — You'll need a LinkedIn profile or company page to post to. Connect via n8n's LinkedIn OAuth integration. Configuration Steps Create a Google Sheet named "AI Content Database" with a sheet called "LinkedIn Posts" containing columns: , , , . Upload a reference image to Google Drive that represents your brand's visual style. Update the Google Sheet ID and folder IDs in the nodes to match your own. Configure all credential connections in n8n for each service. Adjust the cron schedules to match your desired posting frequency. Customize the AI system prompt in the LinkedIn Creator Agent to match your brand voice. Use Cases & Variations Primary Use Cases Personal Brand Building: Automate daily LinkedIn content for thought leaders and consultants. Agency Content Management: Manage multiple client content calendars from a single workflow. Content Repurposing: Adapt the workflow to generate content for Twitter, Instagram, or newsletters. Possible Variations Platform Swap: Replace the LinkedIn node with Twitter, Facebook, or Slack nodes. Research Source: Swap Perplexity for a Google Search API or RSS feed reader. Image Model: Use DALL-E 3 or Stable Diffusion instead of gpt-image-1. Review Workflow: Add a Slack notification node to alert you when posts are ready for review. Multi-Platform Publishing: Duplicate the publishing pipeline for different social networks. Content Calendar: Add a calendar node to schedule posts for specific dates and times.
Auto-Generate Social Posts from YouTube via Dumpling AI
🧠 Automate Social Media Content Creation from YouTube Videos This powerful workflow automatically generates platform-specific social media posts (Instagram, Facebook, LinkedIn) from YouTube videos. It takes a topic from a Google Sheet, searches for relevant YouTube videos using Dumpling AI, selects the best match with GPT-4o, fetches the transcript, and creates tailored posts with matching AI-generated images — all saved back to your Google Sheet. Perfect for content creators, social media managers, and marketers who want to repurpose YouTube content efficiently. The workflow runs on a schedule, processes one topic at a time, and marks topics as completed to avoid duplication. It combines the power of Dumpling AI for YouTube search and image generation, OpenAI's GPT-4o for intelligent content selection and copywriting, and Google Sheets for data management. 📋 Node-by-Node Breakdown Trigger Search Schedule (Schedule Trigger) — No auth required. Runs the workflow on a configurable interval (default: every hour). You can adjust the schedule in the node settings. Get Unsearched Topic from Google Sheet (Google Sheets) — OAuth2 (Google Sheets). Reads the first unsearched topic from the "YouTube Topics" sheet. Uses a filter to find rows where "Searched?" column is empty, and returns only the first match. Search YouTube via Dumpling AI (HTTP Request) — Header Auth (Dumpling AI API key). Sends a POST request to Dumpling AI's YouTube search endpoint with the topic as query. Returns video results matching the search term. Filter + Sort YouTube Videos (Code) — No auth. Custom JavaScript that extracts video data from the API response, filters for video type, sorts by published date (newest first), and returns the 3 most recent videos. Prepare Video List for AI (Aggregate) — No auth. Combines all video items into a single array for processing by the AI node. Select Best Video with GPT-4o (OpenAI) — API Key auth (OpenAI). Uses GPT-4o to analyze the search results and select the most relevant video based on the original topic and current date. Returns the best match in structured JSON format. Get Transcript (Dumpling AI) (HTTP Request) — Header Auth (Dumpling AI API key). Fetches the YouTube transcript for the selected video using Dumpling AI's transcript endpoint. Generate Posts with GPT-4o (OpenAI) — API Key auth (OpenAI). Takes the transcript and generates three platform-specific posts (Instagram, Facebook, LinkedIn) with matching image prompts. Each post is tailored to the platform's style and audience. Generate Instagram Image (Dumpling AI) (HTTP Request) — Header Auth (Dumpling AI API key). Creates an AI-generated image for the Instagram post using FLUX.1-pro model. Generate Facebook Image (Dumpling AI) (HTTP Request) — Header Auth (Dumpling AI API key). Creates an AI-generated image for the Facebook post. Generate LinkedIn Image (Dumpling AI) (HTTP Request) — Header Auth (Dumpling AI API key). Creates an AI-generated image for the LinkedIn post. Format Instagram Post (Set) — No auth. Structures the Instagram post data with platform name, content text, and image URL. Format Facebook Post (Set) — No auth. Structures the Facebook post data similarly. Format LinkedIn Post (Set) — No auth. Structures the LinkedIn post data similarly. Save Instagram Post to Sheet (Google Sheets) — OAuth2 (Google Sheets). Appends the formatted Instagram post to the "Social Media Post" sheet. Save Facebook Post to Sheet (Google Sheets) — OAuth2 (Google Sheets). Appends the formatted Facebook post to the same sheet. Save LinkedIn Post to Sheet (Google Sheets) — OAuth2 (Google Sheets). Appends the formatted LinkedIn post to the same sheet. Merge Post Results (Merge) — No auth. Combines the three post results into a single output for the final update step. Update Topic Status in Sheet (Google Sheets) — OAuth2 (Google Sheets). Marks the original topic as "Searched?" = "Yes" in the YouTube Topics sheet to prevent reprocessing. 🔧 Setup Instructions Required Accounts & Credentials: Google Account — For Google Sheets access. Create OAuth2 credentials in n8n for Google Sheets. Dumpling AI Account — Sign up at app.dumplingai.com and get your API key. Add as Header Auth credential in n8n. OpenAI Account — Get your API key from platform.openai.com. Add as API Key credential in n8n. Required Google Sheets: YouTube Topics sheet with columns: , Social Media Post sheet with columns: , , 💡 Use Cases & Variations Primary Use Cases: Content repurposing for social media managers Automated content calendar creation YouTube-to-social-media content pipeline Brand consistency across platforms Adaptation Ideas: Add more platforms (Twitter/X, TikTok, Pinterest) Schedule posts directly to social media using n8n integrations Add human review step before posting Use different AI models for image generation Add email newsletter content generation Include video thumbnail generation Add analytics tracking for post performance
Contact Form to Slack & Email Notification Workflow
This workflow automates the process of capturing contact form submissions from your website and immediately notifying your team via Slack while also sending a confirmation email to the submitter. It's designed to help businesses respond faster to leads and inquiries without manual intervention. Workflow Steps Form Submission on Website (No auth) — This node creates a simple web form that collects Name, Email, and Phone from visitors. The form is embedded on your website using the provided webhook URL. No authentication is required as it's a public-facing form. Slack (OAuth2) — Sends a formatted message to your designated Slack channel (e.g., #leads) containing the submitted details. Requires a Slack app with bot token and appropriate channel permissions. Send Email - Gmail (OAuth2) — Sends a thank-you email to the submitter using Gmail API. Requires OAuth2 credentials for a Google account. Send Email - Outlook (OAuth2) — Sends the same thank-you email via Microsoft Outlook API. Requires OAuth2 credentials for a Microsoft account. Setup Instructions Slack: Create a Slack app with chat:write scope, install it to your workspace, and add the bot to your target channel. Gmail: Enable Gmail API in Google Cloud Console, create OAuth2 credentials, and authorize the workflow. Outlook: Register an app in Azure AD, grant Mail.Send permission, and configure OAuth2 credentials. Form: Copy the webhook URL from the Form Submission node and embed it as the form action in your HTML form. Use Cases & Variations Lead capture: Replace Slack with CRM nodes (HubSpot, Salesforce) to create contacts automatically. Multi-channel notifications: Add SMS via Twilio or push notifications via Telegram. Conditional routing: Use IF nodes to route different form responses to different Slack channels or email templates. Data enrichment: Add HTTP Request nodes to enrich lead data (e.g., company info from email domain).