{
  "id": "vl9gqoDrHwZq1NwC",
  "name": "Blog Post Content Creation",
  "tags": [],
  "nodes": [
    {
      "id": "4a785756-b71a-4447-93e7-ce7351aba713",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        128,
        880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9941e108-1e6c-4050-8401-9e6125a847de",
              "name": "Brand",
              "type": "string",
              "value": "={{ $json[\"Brand\"] || \"Brand-Name\" }}"
            },
            {
              "id": "06978aeb-e021-4b59-8a42-4225857d7778",
              "name": "Blog Title",
              "type": "string",
              "value": "={{ $json[\"Blog Title\"] || $json[\"Topic\"] || \"Blog Topic/Title\" }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6bbdefd6-2cce-4efb-8dca-b9303dfb224e",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        880
      ],
      "parameters": {
        "jsCode": "let htmlContent = $input.first().json.text;\n\nif (typeof htmlContent === \"string\") {\n  htmlContent = htmlContent\n    .replace(/^```(?:html)?\\s*/i, \"\")\n    .replace(/\\s*```$/i, \"\");\n}\n\nhtmlContent = htmlContent.replace(/<\\/p>/gi, \"</p><br>\");\n\nconst blogTitle = $('Configuration').first().json['Blog Title'] || \"post\";\nconst safeFileName = blogTitle.replace(/[^a-zA-Z0-9-_\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df ]/g, \"_\").trim() || \"post\";\nconst finalFileName = `${safeFileName}.html`;\n\nconst buffer = Buffer.from(htmlContent, \"utf-8\");\n\nreturn [\n  {\n    json: {\n      fileName: finalFileName,\n      mimeType: \"text/html\",\n    },\n    binary: {\n      data: {\n        data: buffer.toString(\"base64\"),\n      },\n    },\n  },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1bdf5ff6-8280-4094-a68d-8b9b9094d5b4",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2032,
        880
      ],
      "parameters": {
        "name": "={{ $json[\"fileName\"] }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1EXVI5bWTMUHJuxsRrf-jsovaBeDQiO3a",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1EXVI5bWTMUHJuxsRrf-jsovaBeDQiO3a",
          "cachedResultName": "Blog-Content Creation"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e673c79a-d07a-449c-b082-91ab92c8b13e",
      "name": "Publish to WordPress",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        880
      ],
      "parameters": {
        "url": "https://your-wordpress-site.com/wp-json/wp/v2/posts",
        "method": "POST",
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "fe346ff1-2005-46e9-ad9d-639c580c6169",
      "name": "IF Loop Finished",
      "type": "n8n-nodes-base.if",
      "position": [
        2704,
        880
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": true,
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "85a54c6f-5004-40be-ac6c-2cf1dbcadc8e",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        2912,
        880
      ],
      "parameters": {
        "text": "=All blog posts have been generated and published.\n\nLast Google Drive file: {{$node[\"Upload file\"].json[\"webViewLink\"]}}\nLast WordPress post: {{$node[\"Publish to WordPress\"].json[\"link\"]}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09JV1Q24JY",
          "cachedResultName": "blog-creation"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "7452af11-46ed-44c7-be26-bbeca673cab4",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        640,
        880
      ],
      "parameters": {
        "text": "=Act as a senior research assistant. What do you know about {{ $json.Brand }}? What services do they offer?",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "c5493027-4966-482b-bd16-a27a7426f87c",
      "name": "Basic LLM Chain1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1280,
        880
      ],
      "parameters": {
        "text": "=You are an SEO professional.\n\nTopic: {{ $('Configuration').item.json['Blog Title'] }}\n\nStyle and guidelines:\n\nWrite like a human, expert and clear.\n\nDo not use horizontal separators between sections.\n\nStructure: exactly one <h1> at the beginning, followed by meaningful <h2> and, if needed, <h3>.\n\nProduce only a valid HTML body without <html> and without <body> wrappers. Allowed tags: <h1>, <h2>, <h3>, <p>, <a>, <ul>, <ol>, <li>, <strong>, <em>.\n\nNo inline CSS, no external resources, no table of contents.\n\nNo internal links.\n\nTotal length about 800 to 1200 words.\n\nOutput HTML only, no accompanying text or explanations.\n\nBegin now.",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "={{ $json.text }}"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7,
      "alwaysOutputData": false
    },
    {
      "id": "88477b55-a485-49f1-ace1-a478cf6d4e77",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1216,
        1104
      ],
      "parameters": {
        "model": "openai/gpt-5",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9be736fb-06dd-4f3f-82f8-ce1a26c68ba3",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        576,
        1104
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "77695b68-d389-4b0e-ab77-f093ac1c8c3c",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -992,
        880
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a7a617f5-0521-427d-ad3d-cdf615893a30",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        240
      ],
      "parameters": {
        "width": 576,
        "height": 416,
        "content": "# Blog Post Content Creation (Multi-Topic Automation)\n\nThis workflow creates an automated path from a list of blog topics to fully prepared content and WordPress drafts. It is designed for teams who manage their ideas in Google Sheets and want an end-to-end system that turns those entries into ready-to-publish material.\n\nFor each row in the sheet, the workflow carries out three major steps: it collects basic brand context, generates a complete HTML article, and saves the output as a file in Google Drive. The same article is also posted to WordPress as a draft so the team can review, edit, or publish from within their CMS.\n\nThe workflow uses a looping mechanism to process one topic at a time. When all rows are complete, it sends a single Slack message with final links for easy access. This makes it suitable for marketing teams, content departments, or anyone who handles a steady queue of topics.\n\nYou can adapt each part to your own tools. If you prefer a different CMS, messaging platform, or storage provider, the structure remains the same. Only the connector nodes need to be swapped.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7d598c0f-da7a-469b-8d01-df5884e886c3",
      "name": "Get Blog Topics",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -464,
        880
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 3
    },
    {
      "id": "eb96e966-31d6-414a-b5c1-3f43e1fdf966",
      "name": "Split In Batches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -192,
        880
      ],
      "parameters": {
        "options": {},
        "batchSize": 1
      },
      "typeVersion": 2
    },
    {
      "id": "4291bd01-164d-40d2-9626-b9d51205f2c1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        720
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 592,
        "content": "## Input & Loop\nReads topic data from Google Sheets and processes each row individually using Split In Batches. This creates a clean loop for multi-topic automation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c498cd2f-90f1-496f-933d-76a1375ef4de",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        720
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 592,
        "content": "## Content Generation\nCreates brand context and full HTML articles using two AI steps. The output is structured, readable, and ready for publishing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d026d760-9dd6-466c-a8e3-229cbeeb887e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1728,
        720
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 592,
        "content": "## Export & Publishing\nConverts the HTML to a file, uploads it to Google Drive, and publishes a draft post to WordPress. When the loop ends, one Slack message confirms completion.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e08423f1-ad04-444b-9792-f3f8f83f5168",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        720
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 592,
        "content": "## Conformation\nGet notified by Slack and start the next iteration"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "258190fe-e2a8-4eea-aaed-792d6aad61a1",
  "connections": {
    "Upload file": {
      "main": [
        [
          {
            "node": "Publish to WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Blog Topics": {
      "main": [
        [
          {
            "node": "Split In Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain1": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Loop Finished": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split In Batches": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF Loop Finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish to WordPress": {
      "main": [
        [
          {
            "node": "Split In Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Blog Topics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}