{
  "name": "Publish Google Docs to WordPress with advance RankMath SEO & Gemini analysis",
  "nodes": [
    {
      "id": "381d7d21-a665-438a-95e4-6f3ae037e6cd",
      "name": "HTTP Request (Export HTML)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        240
      ]
    },
    {
      "id": "fbc679cb-f5ee-43bb-88b9-df5e63b4b551",
      "name": "Code (Extract Body)",
      "type": "n8n-nodes-base.code",
      "position": [
        272,
        240
      ]
    },
    {
      "id": "c80e5132-39fe-4cab-905f-55fdbae1b273",
      "name": "Code (Prepare Metadata)",
      "type": "n8n-nodes-base.code",
      "position": [
        464,
        240
      ]
    },
    {
      "id": "50bdef2e-2e69-4615-a0bf-f2f67ba1919f",
      "name": "HTTP Request (WP - Find Post by Slug)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        352
      ]
    },
    {
      "id": "78bf0faa-9ddd-489e-80ae-53b772b6dc48",
      "name": "Merge (Meta + FindResult)",
      "type": "n8n-nodes-base.merge",
      "position": [
        944,
        256
      ]
    },
    {
      "id": "547a6404-aa5e-4e07-ad7c-1d622add3a4f",
      "name": "IF (Found Post?)",
      "type": "n8n-nodes-base.if",
      "position": [
        1088,
        256
      ]
    },
    {
      "id": "29c70539-b58d-43e8-b97b-50987f1628af",
      "name": "HTTP Request: WP - Create Post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        352
      ]
    },
    {
      "id": "31130a63-f884-4bd8-b2a0-c5e9f96a361e",
      "name": "HTTP Request - WP Update Post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        128
      ]
    },
    {
      "id": "6448aad4-74c5-4fb7-8e7d-eddb3c3f784e",
      "name": "SET - SEO Input",
      "type": "n8n-nodes-base.set",
      "position": [
        1520,
        128
      ]
    },
    {
      "id": "7faf5ea5-17d4-4dab-9e21-c5933ef1c707",
      "name": "GEMINI - SEO JSON",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1680,
        272
      ]
    },
    {
      "id": "348624cd-6a04-441b-8008-7b922368eee6",
      "name": "CODE - Parse & QA SEO",
      "type": "n8n-nodes-base.code",
      "position": [
        2176,
        144
      ]
    },
    {
      "id": "b7e4b632-b0cc-45c4-a10a-c6a4f40d2ae0",
      "name": "HTTP - WP Update SEO (RankMath)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2672,
        288
      ]
    },
    {
      "id": "8e535160-4509-4d61-8d92-975659b616d8",
      "name": "CODE - Build WP Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        2368,
        144
      ]
    },
    {
      "id": "0b749465-5b6e-466f-a2a3-08beff0d5c0c",
      "name": "HTTP - WP Get Post (Verify)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3072,
        288
      ]
    },
    {
      "id": "57865b48-413c-49fc-a58e-42b06a1feba4",
      "name": "MERGE - Attach postId",
      "type": "n8n-nodes-base.merge",
      "position": [
        1968,
        144
      ]
    },
    {
      "id": "004dd064-d904-471d-98b6-d1f9f1743ac2",
      "name": "Google Drive - Move to Published",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3248,
        144
      ]
    },
    {
      "id": "1a253992-69a8-4a1f-a4f4-b9b13a23a049",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -304,
        128
      ]
    },
    {
      "id": "01138756-449d-41e9-8feb-e194c9036242",
      "name": "CONFIG - Edit Settings Here",
      "type": "n8n-nodes-base.set",
      "position": [
        -112,
        240
      ]
    },
    {
      "id": "d339fd1a-8db4-4ae3-9b55-a2f9f70d4d7d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        32
      ],
      "parameters": {
        "width": 976,
        "height": 368,
        "content": "## 1. Input & Cleaning\nMonitors Google Drive for new files, sanitizes raw HTML, and prepares metadata for processing."
      }
    },
    {
      "id": "d7aa0a4c-972b-4396-a5e3-ccbb828f86be",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        32
      ],
      "parameters": {
        "width": 736,
        "height": 496,
        "content": "## 2. Duplicate Check\nQueries WordPress to check if the post exists. Routes to \"Create\" or \"Update\" path to prevent duplicates."
      }
    },
    {
      "id": "73fac425-7102-4470-ad0b-24bf08738363",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        32
      ],
      "parameters": {
        "width": 1024,
        "height": 432,
        "content": "## 3. AI SEO Analysis\nGemini analyzes content to generate Focus Keyword, SEO Title, and Meta Description in structured JSON."
      }
    },
    {
      "id": "05a7dcb9-8be3-4f44-923d-a1d869179c63",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2544,
        32
      ],
      "parameters": {
        "width": 896,
        "height": 432,
        "content": "## 4. Publish & Cleanup\nUpdates WordPress content, maps custom RankMath meta keys via API, and moves files to the \"Published\" folder."
      }
    },
    {
      "id": "b93e82bf-7a05-46db-9690-255a4c8ecb4b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        -80
      ],
      "parameters": {
        "width": 704,
        "height": 608,
        "content": "# Google Drive to WordPress Publisher\n**Auto-publish content with Advanced RankMath SEO & Gemini Analysis.**\n\nThis workflow automates the \"Document Ops\" process for professional content teams. It crea"
      }
    },
    {
      "id": "a108d140-3fad-4cab-9f7f-d26c07cd4f64",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2560,
        176
      ],
      "parameters": {
        "width": 336,
        "height": 256,
        "content": "### ⚠️ CRITICAL REQUIREMENT\nThis node requires the **RankMath Helper PHP Snippet** to be installed on your WordPress site.\nWithout it, RankMath fields cannot be updated via API. Check the template des"
      }
    }
  ],
  "connections": {
    "SET - SEO Input": {
      "main": [
        [
          {
            "node": "GEMINI - SEO JSON",
            "type": "main",
            "index": 0
          },
          {
            "node": "MERGE - Attach postId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF (Found Post?)": {
      "main": [
        [
          {
            "node": "HTTP Request - WP Update Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request: WP - Create Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GEMINI - SEO JSON": {
      "main": [
        [
          {
            "node": "MERGE - Attach postId",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Code (Extract Body)": {
      "main": [
        [
          {
            "node": "Code (Prepare Metadata)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "CONFIG - Edit Settings Here",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CODE - Parse & QA SEO": {
      "main": [
        [
          {
            "node": "CODE - Build WP Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MERGE - Attach postId": {
      "main": [
        [
          {
            "node": "CODE - Parse & QA SEO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CODE - Build WP Payload": {
      "main": [
        [
          {
            "node": "HTTP - WP Update SEO (RankMath)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code (Prepare Metadata)": {
      "main": [
        [
          {
            "node": "HTTP Request (WP - Find Post by Slug)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge (Meta + FindResult)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge (Meta + FindResult)": {
      "main": [
        [
          {
            "node": "IF (Found Post?)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request (Export HTML)": {
      "main": [
        [
          {
            "node": "Code (Extract Body)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CONFIG - Edit Settings Here": {
      "main": [
        [
          {
            "node": "HTTP Request (Export HTML)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP - WP Get Post (Verify)": {
      "main": [
        [
          {
            "node": "Google Drive - Move to Published",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request - WP Update Post": {
      "main": [
        [
          {
            "node": "SET - SEO Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request: WP - Create Post": {
      "main": [
        [
          {
            "node": "SET - SEO Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP - WP Update SEO (RankMath)": {
      "main": [
        [
          {
            "node": "HTTP - WP Get Post (Verify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request (WP - Find Post by Slug)": {
      "main": [
        [
          {
            "node": "Merge (Meta + FindResult)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}