{
  "name": "Nodbot - Notion to WordPress draft",
  "nodes": [
    {
      "parameters": {
        "path": "notion-to-wordpress-draft",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "77b549dd-a54d-4796-8972-7fce01ac7229",
      "name": "Webhook import request",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {},
      "id": "b3e8fd01-15ac-4a8b-b205-4033a46625fe",
      "name": "Fetch Notion page",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst pageTitle = String(src.title ?? src.notion_title ?? 'Черновик без названия').trim();\nconst markdown = String(src.markdown ?? src.content ?? '').trim();\n\nif (!markdown || markdown.length < 500) {\n  throw new Error('Notion page content is too short for WordPress draft');\n}\n\nconst slug = pageTitle\n  .toLowerCase()\n  .replace(/ё/g, 'e')\n  .replace(/[^a-zа-я0-9]+/gi, '-')\n  .replace(/^-|-$/g, '')\n  .slice(0, 80);\n\nconst cleaned = markdown\n  .replace(/<!--.*?-->/gs, '')\n  .replace(/\n{3,}/g, '\n\n')\n  .replace(/\\[(TODO|FIXME)\\]/gi, '**Нужно проверить:**');\n\nreturn [{\n  json: {\n    wordpress: {\n      title: pageTitle,\n      slug,\n      status: src.wordpress_status ?? 'draft',\n      content: cleaned,\n      excerpt: cleaned.replace(/[#*_>`]/g, '').slice(0, 250),\n      categories: src.category_ids ?? [],\n      author: src.author_id ?? undefined\n    },\n    source: {\n      notion_page_id: src.notion_page_id,\n      canonical_url: src.canonical_url ?? '',\n      imported_at: new Date().toISOString()\n    }\n  }\n}];"
      },
      "id": "7ac51b52-1732-4970-880b-f416dd39a675",
      "name": "Prepare WordPress draft",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "23ec835e-cde9-43fe-9e58-8784560b9623",
      "name": "Create WordPress draft",
      "type": "n8n-nodes-base.wordpress",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "5fe667b7-f666-4542-9491-19f245123eef",
      "name": "Return draft URL",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    }
  ],
  "connections": {
    "Webhook import request": {
      "main": [
        [
          {
            "node": "Fetch Notion page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Notion page": {
      "main": [
        [
          {
            "node": "Prepare WordPress draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare WordPress draft": {
      "main": [
        [
          {
            "node": "Create WordPress draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create WordPress draft": {
      "main": [
        [
          {
            "node": "Return draft URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "nodbot",
    "production",
    "template"
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-30T00:00:00.000Z",
  "versionId": "98f699fd-9716-42c9-8f0a-62d7e89df6e9",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}