{
  "name": "AI Blog Draft to WordPress",
  "nodes": [
    {
      "parameters": {
        "content": "## AI Blog Draft Generator to WordPress\n\nTurn a topic and three bullet points into a structured WordPress draft - you stay the editor, the AI does the blank-page part.\n\n**Setup time:** 15 minutes  ·  **Level:** Intermediate\n\n**You'll need accounts/credentials for:** OpenAI, WordPress\n\n**Setup steps:**\n1. Add your OpenAI API key in the OpenAI node.\n2. Connect WordPress: your site URL plus an Application Password (Users > Profile > Application Passwords).\n3. Open the Form Trigger node and copy the production form URL - bookmark it.\n4. Activate the workflow, submit a test topic, and check Posts > Drafts in WordPress.\n\nFree templates and updates: navkhan103.github.io",
        "height": 530,
        "width": 400,
        "color": 4
      },
      "id": "sticky-setup",
      "name": "Setup — read me first",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -440,
        -40
      ]
    },
    {
      "parameters": {
        "content": "### How it runs\n\nStarts from **Draft Request Form**.\n\n1. An n8n Form Trigger gives you a hosted form with topic, audience, and key-points fields.\n2. An OpenAI node writes a structured draft in clean HTML: title, intro, H2 sections built from your key points, and a conclusion with a call to action.\n3. A Code node splits the AI output into title and body.\n4. A WordPress node creates the post with status 'draft' so nothing goes live without your edit.",
        "height": 348,
        "width": 400,
        "color": 7
      },
      "id": "sticky-how",
      "name": "How it runs",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -440,
        530
      ]
    },
    {
      "parameters": {
        "content": "### If something breaks\n\nThe read and AI nodes here **retry 3× automatically** (5s apart), which absorbs rate limits and brief timeouts.\n\nNodes that **send or write deliberately do not retry** — a send that reached the far end but lost its response would otherwise fire twice, so you'd get duplicate messages or duplicate rows.\n\nTo be told when one of those fails, build a workflow starting with an **Error Trigger** node that posts to Slack or email, then set it under **three-dot menu > Settings > Error Workflow**. Do it once and point every workflow at it.",
        "height": 400,
        "width": 400,
        "color": 3
      },
      "id": "sticky-fail",
      "name": "If something breaks",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -440,
        918
      ]
    },
    {
      "parameters": {
        "formTitle": "Blog draft request",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Topic",
              "requiredField": true
            },
            {
              "fieldLabel": "Audience",
              "requiredField": true
            },
            {
              "fieldLabel": "Key points (one per line)",
              "fieldType": "textarea",
              "requiredField": true
            }
          ]
        },
        "responseMode": "onReceived"
      },
      "id": "f7a8b9c0-0001-4000-8000-000000000001",
      "name": "Draft Request Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "webhookId": "blog-draft-form"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.6-terra"
        },
        "messages": {
          "values": [
            {
              "content": "=You are a senior content writer. Write a blog post draft.\n\nTopic: {{ $json.Topic }}\nAudience: {{ $json.Audience }}\nKey points to cover:\n{{ $json['Key points (one per line)'] }}\n\nFormat your reply EXACTLY like this:\nTITLE: <one compelling title, max 60 characters>\nBODY:\n<the post in clean HTML: a short intro paragraph, one <h2> section per key point with 2-3 paragraphs each, and a closing section with a call to action. No <html> or <body> tags. 800-1200 words. Write plainly - no buzzwords, no fluff.>",
              "role": "user"
            }
          ]
        }
      },
      "id": "f7a8b9c0-0002-4000-8000-000000000002",
      "name": "Write Draft",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        220,
        0
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000
    },
    {
      "parameters": {
        "jsCode": "const raw = $input.first().json.message.content;\nconst titleMatch = raw.match(/TITLE:\\s*(.+)/);\nconst bodyMatch = raw.match(/BODY:\\s*([\\s\\S]+)/);\nreturn [{ json: {\n  title: titleMatch ? titleMatch[1].trim() : 'Untitled draft',\n  content: bodyMatch ? bodyMatch[1].trim() : raw\n} }];"
      },
      "id": "f7a8b9c0-0003-4000-8000-000000000003",
      "name": "Split Title and Body",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ]
    },
    {
      "parameters": {
        "title": "={{ $json.title }}",
        "additionalFields": {
          "content": "={{ $json.content }}",
          "status": "draft"
        }
      },
      "id": "f7a8b9c0-0004-4000-8000-000000000004",
      "name": "Create WordPress Draft",
      "type": "n8n-nodes-base.wordpress",
      "typeVersion": 1,
      "position": [
        660,
        0
      ]
    }
  ],
  "connections": {
    "Draft Request Form": {
      "main": [
        [
          {
            "node": "Write Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Draft": {
      "main": [
        [
          {
            "node": "Split Title and Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Title and Body": {
      "main": [
        [
          {
            "node": "Create WordPress Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}