{
  "name": "Auto-generate & publish SEO articles to WordPress with GPT-4 + Postgres tracking",
  "nodes": [
    {
      "id": "f71a8a34-5d88-48b0-bf56-44c95d970abd",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1120,
        -560
      ]
    },
    {
      "id": "8ce11fcd-806c-44ea-aa5f-015599eacc98",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2060,
        -20
      ]
    },
    {
      "id": "c9450a63-a89e-46eb-b083-b0f40d7b797c",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2620,
        100
      ]
    },
    {
      "id": "f477482d-d9b6-4d83-b707-dd19da90e25e",
      "name": "Prepare Post JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        3440,
        -520
      ]
    },
    {
      "id": "12191b30-702c-44dd-bfaf-68de02f627b1",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        3200,
        -520
      ]
    },
    {
      "id": "9c21f5ce-b353-4193-a93d-a034e025a1a0",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        640,
        -20
      ]
    },
    {
      "id": "723d9202-7fb0-43ca-8945-8bd4b5030eb8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2420,
        -1340
      ],
      "parameters": {
        "width": 1180,
        "height": 1780,
        "content": "# 🤖 WordPress Blog Automation Workflow\n\n## 🛠 SETUP (do once before running the flow)\n\n### 1 · DOMAIN  \nAdd one variable anywhere **before** the workflow starts (via Set node, `.env`, or instance confi"
      }
    },
    {
      "id": "550017b6-481b-4591-8d87-04761244ef3b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "⏰ Triggers this workflow every few hours."
      }
    },
    {
      "id": "8d6ae5db-3d88-4e3a-8567-6e38a6002acd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📥 Loads all WordPress categories."
      }
    },
    {
      "id": "3ef86b3a-18a1-42b7-896c-ef2352148b38",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🧹 Filters out excluded category IDs.\n\nChoose them yourself, some categories are not for AI Agent, like reviews or same"
      }
    },
    {
      "id": "3cc6a088-0698-478d-896b-9af0f5f03f00",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🗃 Loads recently used categories from DB."
      }
    },
    {
      "id": "9eccdda9-1cee-42d1-8451-24b0104917b5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🎯 Picks least-used category for next post."
      }
    },
    {
      "id": "1f9a4bb2-c482-47d2-9ebd-4ff1be58b3d8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -360
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📄 Loads 10 latest article titles for the selected category."
      }
    },
    {
      "id": "5faba628-67c5-4e1b-889e-7cc1b72a23d0",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -360
      ],
      "parameters": {
        "width": 300,
        "height": 460,
        "content": "🧠 Generates a unique article title with GPT."
      }
    },
    {
      "id": "d23c4134-a06e-4630-a5e5-8a9b90259d4c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        -360
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🧾 Prepares the new article title."
      }
    },
    {
      "id": "da20f973-6889-460c-84b8-cbff0c6ceaa2",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🔀 Merges category + title data."
      }
    },
    {
      "id": "2048e683-1b37-49e4-9bc5-2530becf26ee",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📦 Combines all post metadata into one object."
      }
    },
    {
      "id": "a5aafb45-6e89-435b-9b41-63d2b5fd8cd5",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📝 Saves used category and title to DB."
      }
    },
    {
      "id": "f63a22c4-2f78-4820-87d4-eb1510f51bcc",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        -360
      ],
      "parameters": {
        "width": 300,
        "height": 460,
        "content": "✍️ Writes full WordPress-style HTML article."
      }
    },
    {
      "id": "24721fd7-cb69-44b6-a48d-91f195e861cc",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2320,
        -480
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🧾 Extracts content block from AI output."
      }
    },
    {
      "id": "f5bd3e8b-c188-494e-b662-ce5722848ae4",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2320,
        -100
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🖼 Prepares a placeholder cover image URL."
      }
    },
    {
      "id": "933fe208-7c8e-4683-a09b-bfd91ed22bef",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2560,
        -100
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "⬇️ Downloads the cover image."
      }
    },
    {
      "id": "78053d06-b008-403d-b6a1-d5546814d1e9",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2800,
        -100
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📤 Uploads image to WordPress media."
      }
    },
    {
      "id": "d11f85b0-664f-4c63-b34b-a510480957e7",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3140,
        -720
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🔗 Merges image + content + category info."
      }
    },
    {
      "id": "01fcdc38-8627-4818-8f78-b45681d22d26",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3380,
        -720
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "📬 Prepares final JSON body for the WP post."
      }
    },
    {
      "id": "10f89350-e129-41df-803c-450f3fb07193",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3620,
        -720
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "🚀 Publishes post to your WordPress site."
      }
    },
    {
      "id": "bd082511-91aa-425f-9bf3-cadb3900c749",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -360
      ],
      "parameters": {
        "width": 220,
        "height": 300,
        "content": "Make sure:\n- Your WordPress site allows public access to `/wp-json/wp/v2/categories`\n- You have at least 1 category created\n- No security plugin (like Wordfence) is blocking REST API\n\nNo credential ne"
      }
    },
    {
      "id": "5f46d958-b7de-405e-a95e-57a9c0366b52",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -360
      ],
      "parameters": {
        "width": 220,
        "height": 300,
        "content": "Make sure:\n- You've created the table (see setup note)\n- Credential `YOUR_POSTGRES_CREDENTIAL` is configured\n- DB user has `SELECT` rights on the table\n\nTip: This selects the least recently used categ"
      }
    },
    {
      "id": "3f90d8c5-7dd9-41c4-a862-e21942fdc87d",
      "name": "Load Categories",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -640,
        -560
      ]
    },
    {
      "id": "8b2cb2f8-2a2e-4e92-81b6-36e9e2105f94",
      "name": "Category Filter",
      "type": "n8n-nodes-base.code",
      "position": [
        -400,
        -560
      ]
    },
    {
      "id": "083202d5-7053-4775-b053-2e503ce7d73f",
      "name": "Selecting recent",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -160,
        -560
      ]
    },
    {
      "id": "98f3ec81-f1f9-425b-83b0-2d5732acb19e",
      "name": "Picks Less Used",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        -560
      ]
    },
    {
      "id": "8f94b488-d3fb-4016-a8ac-ed0e13f78190",
      "name": "10 latest headlines",
      "type": "n8n-nodes-base.postgres",
      "position": [
        400,
        -200
      ]
    },
    {
      "id": "04349d4d-06cc-48fc-88ae-588ec527fca4",
      "name": "New article title",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -200
      ]
    },
    {
      "id": "9d145f01-ff77-4c72-bec2-d8ead60d79e5",
      "name": "AI Agent SEO Headings",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        600,
        -200
      ]
    },
    {
      "id": "29ad413c-4ee4-4d96-8793-3a8cb4a4ce1b",
      "name": "AI Agent SEO writer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2020,
        -200
      ]
    },
    {
      "id": "5b1efebe-f9e7-4088-9363-75280ba36528",
      "name": "Merge heading",
      "type": "n8n-nodes-base.merge",
      "position": [
        1280,
        -540
      ]
    },
    {
      "id": "187423ce-b80a-4e28-bdd1-02818a6dcd8f",
      "name": "Combines full post meta",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        -540
      ]
    },
    {
      "id": "85c0e9e2-6f2b-4bd4-9f71-f7efe940ed14",
      "name": "Updating posts DB",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1760,
        -540
      ]
    },
    {
      "id": "73975cf0-165c-4f53-aff9-12872a4dd228",
      "name": "Extracting output",
      "type": "n8n-nodes-base.code",
      "position": [
        2380,
        -280
      ]
    },
    {
      "id": "a5030427-0bc1-499a-903e-e10ba81a9b0d",
      "name": "Placeholder creator",
      "type": "n8n-nodes-base.code",
      "position": [
        2380,
        100
      ]
    },
    {
      "id": "6f0f0202-3803-48ef-b8f5-dd56a023c43f",
      "name": "Media Upload to WP",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2860,
        100
      ]
    },
    {
      "id": "0621bad7-e7bf-4aae-bbf3-2e1f571d81d8",
      "name": "Post to WP",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3680,
        -520
      ]
    },
    {
      "id": "28f3b69a-22a2-4448-a9d0-a5fd42e1ed2c",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        3900,
        -520
      ]
    },
    {
      "id": "c98d9193-1dd9-493c-bf76-b72de8e53e28",
      "name": "Sticky Note22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -940,
        -740
      ],
      "parameters": {
        "width": 220,
        "height": 360,
        "content": "! Set your WordPress domain inside the “Config” Set node.\n"
      }
    },
    {
      "id": "1c881f9f-dcf1-4bf0-889b-0738d1ff49a4",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -880,
        -560
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Prepare Post JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Load Categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to WP": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge heading": {
      "main": [
        [
          {
            "node": "Combines full post meta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Media Upload to WP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Category Filter": {
      "main": [
        [
          {
            "node": "Selecting recent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Categories": {
      "main": [
        [
          {
            "node": "Category Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Picks Less Used": {
      "main": [
        [
          {
            "node": "10 latest headlines",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge heading",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Selecting recent": {
      "main": [
        [
          {
            "node": "Picks Less Used",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extracting output": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "New article title": {
      "main": [
        [
          {
            "node": "Merge heading",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent SEO writer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Post JSON": {
      "main": [
        [
          {
            "node": "Post to WP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Updating posts DB": {
      "main": [
        [
          {
            "node": "AI Agent SEO writer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Media Upload to WP": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent SEO Headings",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "10 latest headlines": {
      "main": [
        [
          {
            "node": "AI Agent SEO Headings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent SEO writer": {
      "main": [
        [
          {
            "node": "Placeholder creator",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extracting output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Placeholder creator": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent SEO Headings": {
      "main": [
        [
          {
            "node": "New article title",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combines full post meta": {
      "main": [
        [
          {
            "node": "Updating posts DB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}