{
  "name": "Translate WordPress posts and ACF fields using DeepL and OpenAI",
  "nodes": [
    {
      "id": "b09ce46f-19e9-4ee4-9538-a76f417649fb",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1568,
        64
      ]
    },
    {
      "id": "58826b48-c964-4df2-a049-72bef987081f",
      "name": "Get Post Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1344,
        56
      ]
    },
    {
      "id": "9c7cff9a-c5c1-4af5-a5fb-196225b74998",
      "name": "Prepare Text Snippet",
      "type": "n8n-nodes-base.function",
      "position": [
        -1120,
        56
      ]
    },
    {
      "id": "7558b3a4-95f7-4db2-87e0-a64f4b9c7ace",
      "name": "OpenAI Language Detect",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -896,
        56
      ]
    },
    {
      "id": "b5d17f47-d5c0-40fa-a5f7-deff90984546",
      "name": "Smart Router & Targets",
      "type": "n8n-nodes-base.function",
      "position": [
        -672,
        56
      ]
    },
    {
      "id": "f326e6d2-bf5c-4d14-8c6d-242da29f7dad",
      "name": "Needs WP Lang Fix?",
      "type": "n8n-nodes-base.if",
      "position": [
        -448,
        56
      ]
    },
    {
      "id": "ce0b4c3b-4019-4ab6-9d03-4280624e4438",
      "name": "Fix WP Language Flag",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -224,
        -16
      ]
    },
    {
      "id": "bf7b9308-ce6c-45fe-aa2f-3c83d8af30f9",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        0,
        56
      ]
    },
    {
      "id": "fa16eebf-412f-4acd-b76a-9260aa77f5c5",
      "name": "Needs Translations?",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        56
      ]
    },
    {
      "id": "47ec6995-9e87-42e8-b3c8-2d0b0c0261a6",
      "name": "Extract Content",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        64
      ]
    },
    {
      "id": "a96fb374-69b4-4770-a356-003d4d0ecf8a",
      "name": "Split by Target Lang",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        672,
        56
      ]
    },
    {
      "id": "6d8785f6-f053-4959-94a3-730d4dc38490",
      "name": "DeepL Translate",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        896,
        56
      ]
    },
    {
      "id": "5a1a2eb4-f4e0-48fa-9cc3-52e8db6b0c84",
      "name": "RECONSTRUCT JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        56
      ]
    },
    {
      "id": "2e280904-8300-4cac-b537-6fa3843b6962",
      "name": "Create Translated Post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1344,
        56
      ]
    },
    {
      "id": "c3e32f1f-9c6f-482c-992a-52625b5e4a43",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        -304
      ],
      "parameters": {
        "width": 352,
        "height": 768,
        "content": "# Smart WP Translation (Gutenberg + ACF)\n\nThis workflow automatically translates new or updated WordPress posts into multiple languages using DeepL, while keeping your Advanced Custom Fields (ACF) JSO"
      }
    },
    {
      "id": "7a704daf-301f-4a7e-a39b-d6ba668b3fbc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        -32
      ],
      "parameters": {
        "width": 464,
        "height": 288,
        "content": "## 1. Trigger & Fetch Raw WP Post Data"
      }
    },
    {
      "id": "7d448172-2b66-4103-acc0-04a47c4dec73",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        -32
      ],
      "parameters": {
        "width": 1312,
        "height": 288,
        "content": "## 2. AI Language Detection & Smart Routing"
      }
    },
    {
      "id": "e6691bca-a7fd-49bd-ad2c-0adf947a2a65",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -32
      ],
      "parameters": {
        "width": 880,
        "height": 288,
        "content": "## 3. Flatten ACF Structure & Translate with DeepL"
      }
    },
    {
      "id": "d88a9828-8e59-4f5c-a8b2-d1481b8abe8c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        -32
      ],
      "parameters": {
        "width": 528,
        "height": 288,
        "content": "## 4. Rebuild ACF Object & Push to WordPress"
      }
    },
    {
      "id": "d0057bbd-9ac6-4863-8b42-c8fed6d25e30",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        208
      ],
      "parameters": {
        "width": 208,
        "height": 176,
        "content": "### URL and WP APP Password\nUpdate the URL to your WP domain and select your WP App Password credentials."
      }
    },
    {
      "id": "30e91335-d3c5-440a-ac42-05d1ed21e6af",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        208
      ],
      "parameters": {
        "width": 208,
        "height": 176,
        "content": "### URL and WP APP Password\nUpdate the URL to your WP domain and select your WP App Password credentials."
      }
    },
    {
      "id": "e3bfb431-9ac1-4ce7-853f-204ed19e8d19",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        208
      ],
      "parameters": {
        "width": 176,
        "height": 176,
        "content": "### Configuration: \nOpen this node and update the \"allSupported\" array to match your website's languages."
      }
    },
    {
      "id": "2898babf-c8fd-4407-b597-ed8d8df1456d",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        208
      ],
      "parameters": {
        "width": 176,
        "height": 176,
        "content": "### ACF Keys\nOpen this node and update the \"textKeys\" array to match the actual ACF field names used on your WordPress site"
      }
    },
    {
      "id": "ad985939-851f-46c1-8fe2-05ef2c582a5a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        224
      ],
      "parameters": {
        "width": 176,
        "height": 176,
        "content": "### DEEPL Translate\nAdd your DeepL API Key in the Header Parameters."
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Needs Translations?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Get Post Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Post Data": {
      "main": [
        [
          {
            "node": "Prepare Text Snippet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepL Translate": {
      "main": [
        [
          {
            "node": "RECONSTRUCT JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Content": {
      "main": [
        [
          {
            "node": "Split by Target Lang",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RECONSTRUCT JSON": {
      "main": [
        [
          {
            "node": "Create Translated Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs WP Lang Fix?": {
      "main": [
        [
          {
            "node": "Fix WP Language Flag",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Needs Translations?": {
      "main": [
        [
          {
            "node": "Extract Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fix WP Language Flag": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Text Snippet": {
      "main": [
        [
          {
            "node": "OpenAI Language Detect",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split by Target Lang": {
      "main": [
        [
          {
            "node": "DeepL Translate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Language Detect": {
      "main": [
        [
          {
            "node": "Smart Router & Targets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Smart Router & Targets": {
      "main": [
        [
          {
            "node": "Needs WP Lang Fix?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}