{
  "name": "Nodbot - Notion content pipeline with idempotency",
  "nodes": [
    {
      "parameters": {
        "path": "integration-notion-n8n-content-ops",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "7e00fdee-d4b7-4eb8-985c-ecd9203c700f",
      "name": "Notion Ready Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst title = String(src.title ?? src.properties?.Title?.title?.[0]?.plain_text ?? '').trim();\nconst slug = String(src.slug ?? src.properties?.Slug?.rich_text?.[0]?.plain_text ?? '').trim().toLowerCase();\nconst status = String(src.status ?? src.properties?.Status?.select?.name ?? '').trim();\nconst deadline = String(src.deadline ?? src.properties?.Deadline?.date?.start ?? '').trim();\nif (!title || !slug) throw new Error('Notion page requires title and slug');\nif (!/^[-a-z0-9]+$/.test(slug)) throw new Error(`Invalid slug: ${slug}`);\nif (!['Ready for automation','Ready to publish'].includes(status)) {\n  return [{ json: { action: 'skip', reason: 'wrong_status', status, page_id: src.page_id ?? src.id } }];\n}\nconst externalId = String(src.external_id ?? `notion:${slug}`);\nreturn [{ json: {\n  action: 'create_draft', page_id: src.page_id ?? src.id, external_id: externalId,\n  title, slug, deadline, tags: src.tags ?? [], status,\n  idempotency_key: externalId,\n  publish_payload: { title, slug, status: 'draft', source: 'notion', deadline }\n}}];"
      },
      "id": "1034cabf-0557-45a3-82fa-480b7bfa6846",
      "name": "Validate Notion properties",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "fcedc270-adb5-425a-b5e5-2eb802de57b3",
      "name": "Check idempotency",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "1dd7cb2c-d491-4d91-be4b-f794145153ca",
      "name": "Create draft or task",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "60269198-cfb8-49ef-93b5-422fbc829844",
      "name": "Update Notion status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "2441e3df-2a91-4a0e-940e-d85515fad616",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Notion Ready Trigger": {
      "main": [
        [
          {
            "node": "Validate Notion properties",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Notion properties": {
      "main": [
        [
          {
            "node": "Check idempotency",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check idempotency": {
      "main": [
        [
          {
            "node": "Create draft or task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create draft or task": {
      "main": [
        [
          {
            "node": "Update Notion status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Notion status": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "nodbot",
    "integration",
    "production"
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-30T00:00:00.000Z",
  "versionId": "4a5eadc5-011c-432e-b3e3-bacb6ec75a08",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}