{ "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" }, "options": {} }, "credentials": { "openAiApi": { "id": "BSiASwH9CasrT3uK", "name": "OpenAi account" } }, "typeVersion": 1.2 }, { "id": "c9450a63-a89e-46eb-b083-b0f40d7b797c", "name": "Download Image", "type": "n8n-nodes-base.httpRequest", "position": [ 2620, 100 ], "parameters": { "url": "={{ $json.image_url }}", "options": { "response": { "response": { "responseFormat": "file", "outputPropertyName": "imagedownloaded" } } } }, "typeVersion": 4.2 }, { "id": "f477482d-d9b6-4d83-b707-dd19da90e25e", "name": "Prepare Post JSON", "type": "n8n-nodes-base.code", "position": [ 3440, -520 ], "parameters": { "jsCode": "const items = $input.all();\n\nlet image = null;\nlet contentBlock = null;\nlet categoryBlock = null;\nlet titleBlock = null;\n\n// Inspect all incoming JSON\nfor (const item of items) {\n const json = item.json;\n\n // Detect image\n if (json?.source_url && json?.media_type === 'image') {\n image = json;\n continue;\n }\n\n // Detect GPT-generated content\n if (typeof json.content === 'string' && json.content.includes(' ... \n- Level 3 headings inside: ... \n- Level 4 headings inside: ... \n- Lists inside: ... \n- Table of contents using: with anchor links\n- Final section: conclusion in list format\n- Final block: call-to-action with the link \"{{ $('Combines full post meta').item.json.link }}\" or {{$node[\"Config\"].json[\"domain\"]}}\n\nπ― Use the topic info from:\n- name: {{ $json.name }}\n- description: {{ $json.description }}\n- link: {{ $('Combines full post meta').item.json.link }}\n\n---\n\nβοΈ General writing guidelines:\n- The main theme always follows `name` and `description`\n- Each post must focus on a new subtopic (narrower than the main theme)\n- The article must be useful, professional, and well-structured\n- Avoid fluff or repetition β deliver actionable advice\n- Output should follow valid WordPress HTML blocks strictly\n\n---\n\nπ‘ Examples of subtopics for \"{{ $json.name }}\":\n- Top 5 beginner tools in {{ $json.name }}\n- How to choose the right {{ $json.name }} without risks\n- Common mistakes in using {{ $json.name }}\n- How to monetize with CPA or RevShare in {{ $json.name }}\n- Smart strategies to scale {{ $json.name }} traffic in 2025\n- Proven international platforms in {{ $json.name }} β worth trying?\n- What leads to account bans in {{ $json.name }}\n- Top scaling errors in {{ $json.name }}\n\nIn every post, generate a **new and unique** subtopic β no repeats.\n\n---\n\nπ¨ Important:\nOnly output raw WordPress blocks β no additional formatting or notes.\n\nπ§± Structure Example:\n\n1. Introduction:\n\n
A short, attention-grabbing intro explaining what the article covers and why it matters.
\n\n\n2. Table of Contents:\n\nInformative paragraph with practical insights.
\n\n\n\nOptional second paragraph β avoid repetition.
\n\n\n4. Actionable Tips:\n\nSummarize key takeaways and motivate the reader to take action.
\n\n\n6. Call to Action:\n\nRead more at {{$node[\"Config\"].json[\"domain\"]}}/
\n", "options": {}, "promptType": "define" }, "typeVersion": 1.9 }, { "id": "5b1efebe-f9e7-4088-9363-75280ba36528", "name": "Merge heading", "type": "n8n-nodes-base.merge", "position": [ 1280, -540 ], "parameters": {}, "typeVersion": 3.1 }, { "id": "187423ce-b80a-4e28-bdd1-02818a6dcd8f", "name": "Combines full post meta", "type": "n8n-nodes-base.code", "position": [ 1520, -540 ], "parameters": { "jsCode": "let data = {};\n$input.all().forEach(item => {\n Object.assign(data, item.json);\n});\nreturn [{ json: data }];\n" }, "typeVersion": 2 }, { "id": "85c0e9e2-6f2b-4bd4-9f71-f7efe940ed14", "name": "Updating posts DB", "type": "n8n-nodes-base.postgres", "position": [ 1760, -540 ], "parameters": { "table": { "__rl": true, "mode": "list", "value": "used_categories", "cachedResultName": "used_categories" }, "schema": { "__rl": true, "mode": "list", "value": "public" }, "columns": { "value": { "name": "={{ $json.name }}", "title": "={{ $json.title }}", "used_at": "={{ new Date().toISOString() }}", "category_id": "={{ $json.id }}", "description": "={{ $json.description }}" }, "schema": [ { "id": "id", "type": "number", "display": true, "removed": true, "required": false, "displayName": "id", "defaultMatch": true, "canBeUsedToMatch": true }, { "id": "category_id", "type": "number", "display": true, "removed": false, "required": false, "displayName": "category_id", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "name", "type": "string", "display": true, "required": false, "displayName": "name", "defaultMatch": false, "canBeUsedToMatch": false }, { "id": "used_at", "type": "dateTime", "display": true, "required": false, "displayName": "used_at", "defaultMatch": false, "canBeUsedToMatch": false }, { "id": "description", "type": "string", "display": true, "required": false, "displayName": "description", "defaultMatch": false, "canBeUsedToMatch": false }, { "id": "title", "type": "string", "display": true, "required": false, "displayName": "title", "defaultMatch": false, "canBeUsedToMatch": false } ], "mappingMode": "defineBelow", "matchingColumns": [ "category_id" ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {}, "operation": "upsert" }, "credentials": { "postgres": { "id": "JKCOXnEh1Bqg4Gad", "name": "YOUR_POSTGRES_CREDENTIAL" } }, "typeVersion": 2.6 }, { "id": "73975cf0-165c-4f53-aff9-12872a4dd228", "name": "Extracting output", "type": "n8n-nodes-base.code", "position": [ 2380, -280 ], "parameters": { "jsCode": "return [{\n json: {\n content: $input.first().json.output,\n }\n}];\n" }, "typeVersion": 2 }, { "id": "a5030427-0bc1-499a-903e-e10ba81a9b0d", "name": "Placeholder creator", "type": "n8n-nodes-base.code", "position": [ 2380, 100 ], "parameters": { "jsCode": "const name = $('Updating posts DB').first().json.name || \"{{ $json.domain }}\";\nconst encoded = encodeURIComponent(name); \n\nreturn {\n image_url: `https://placehold.co/1200x675/FF0000/FFFFFF.png?text=${encoded}&font=montserrat`\n};\n" }, "typeVersion": 2 }, { "id": "6f0f0202-3803-48ef-b8f5-dd56a023c43f", "name": "Media Upload to WP", "type": "n8n-nodes-base.httpRequest", "position": [ 2860, 100 ], "parameters": { "url": "={{ $('Config').first().json.domain }}/wp-json/wp/v2/media", "method": "POST", "options": {}, "sendBody": true, "contentType": "binaryData", "sendHeaders": true, "authentication": "predefinedCredentialType", "headerParameters": { "parameters": [ { "name": "Content-Disposition", "value": "attachment; filename=crypto.webp" }, { "name": "Content-Type", "value": "image/png" } ] }, "inputDataFieldName": "imagedownloaded", "nodeCredentialType": "wordpressApi" }, "credentials": { "wordpressApi": { "id": "7NOAxTvRC1RY2TSN", "name": "Wordpress account" } }, "typeVersion": 4.2 }, { "id": "0621bad7-e7bf-4aae-bbf3-2e1f571d81d8", "name": "Post to WP", "type": "n8n-nodes-base.httpRequest", "position": [ 3680, -520 ], "parameters": { "url": "={{ $('Config').first().json.domain }}/wp-json/wp/v2/posts", "method": "POST", "options": {}, "sendBody": true, "authentication": "predefinedCredentialType", "bodyParameters": { "parameters": [ { "name": "title", "value": "={{ $json[\"title\"] }}" }, { "name": "content", "value": "={{ $json.content }}" }, { "name": "status", "value": "={{ $json.status }}" }, { "name": "featured_media", "value": "={{ $json[\"featured_media\"] }}" }, { "name": "categories[0]", "value": "={{ $json[\"categories\"][0] }}" } ] }, "nodeCredentialType": "wordpressApi" }, "credentials": { "wordpressApi": { "id": "7NOAxTvRC1RY2TSN", "name": "Wordpress account" } }, "typeVersion": 4.2 }, { "id": "28f3b69a-22a2-4448-a9d0-a5fd42e1ed2c", "name": "No Operation, do nothing", "type": "n8n-nodes-base.noOp", "position": [ 3900, -520 ], "parameters": {}, "typeVersion": 1 }, { "id": "c98d9193-1dd9-493c-bf76-b72de8e53e28", "name": "Sticky Note22", "type": "n8n-nodes-base.stickyNote", "position": [ -940, -740 ], "parameters": { "color": 4, "width": 220, "height": 360, "content": "! Set your WordPress domain inside the βConfigβ Set node.\n" }, "typeVersion": 1 }, { "id": "1c881f9f-dcf1-4bf0-889b-0738d1ff49a4", "name": "Config", "type": "n8n-nodes-base.set", "position": [ -880, -560 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "d7165db3-6fc8-4398-aa16-29a34ff27d78", "name": "domain", "type": "string", "value": "https://yourdomain.com" } ] } }, "typeVersion": 3.4 } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "versionId": "f787c571-bcc3-47d6-82ca-f138fa2922e1", "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 } ] ] } } }