{
  "name": "Secure web form to Odoo CRM lead creation with UTM tracking",
  "nodes": [
    {
      "id": "87228205-1f02-474e-a99d-03471805e0d3",
      "name": "Webhook - Lead Webform",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -3344,
        560
      ]
    },
    {
      "id": "27f055d9-7e29-4acd-8d4b-de356b611355",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1872,
        544
      ]
    },
    {
      "id": "dc8702e9-c4c6-487e-a5e0-19a2dda4ad94",
      "name": "Create Lead",
      "type": "n8n-nodes-base.odoo",
      "position": [
        -1504,
        544
      ]
    },
    {
      "id": "1c7b3f98-b467-4218-934c-c34ab2efebc8",
      "name": "Prepare Request",
      "type": "n8n-nodes-base.code",
      "position": [
        -1696,
        528
      ]
    },
    {
      "id": "6299f436-0481-4291-8b70-e62555cfb76b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        416
      ],
      "parameters": {
        "width": 816,
        "height": 384,
        "content": "## Odoo - Lead Create \nPreparation of the request creating the right body for Lead custom object"
      }
    },
    {
      "id": "1bb410d2-86d5-458a-86bb-a5b6a9938df2",
      "name": "Execution Data",
      "type": "n8n-nodes-base.executionData",
      "position": [
        -1296,
        544
      ]
    },
    {
      "id": "b3c48a34-824e-471a-bea7-a5a1f4ac0933",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        240
      ],
      "parameters": {
        "width": 400,
        "height": 544,
        "content": "## Webhook linked to different sources \nExample:\n{\n    \"firstname\" : \"John\",\n    \"lastname\" : \"Doe\",\n    \"phone\" : \"+393331212123\",\n    \"email\" : \"test@outlook.com\",\n    \"source\" : \"Ads\",\n    \"medium\""
      }
    },
    {
      "id": "b4cfdde2-570e-4e0f-bd2f-7f69bfc5fa65",
      "name": "UTM: Get Source ID",
      "type": "n8n-nodes-base.odoo",
      "position": [
        -2704,
        176
      ]
    },
    {
      "id": "2db2e52d-ff07-4bf0-8f69-7ff99e39a3c4",
      "name": "UTM: Get Medium ID",
      "type": "n8n-nodes-base.odoo",
      "position": [
        -2704,
        304
      ]
    },
    {
      "id": "232bdab3-82c5-454a-866e-4ddb90eea4d7",
      "name": "UTM: Get Campaign ID",
      "type": "n8n-nodes-base.odoo",
      "position": [
        -2704,
        432
      ]
    },
    {
      "id": "569cdaf8-08aa-469d-a37e-c876359cc121",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4544,
        240
      ],
      "parameters": {
        "width": 512,
        "height": 672,
        "content": "## How To Use\n\n### Prerequisites\n- **Odoo**: enable Leads (CRM → Settings → Leads).\n- **Odoo API Key** for your user (use it as the *password*).\n- **n8n Odoo credentials**: URL, DB name, Login, **API "
      }
    },
    {
      "id": "45fba007-2cc9-45a9-aafc-d3ba6281cc56",
      "name": "Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -1088,
        544
      ]
    },
    {
      "id": "c69cb8d1-78c8-4196-b3c4-384954e7e230",
      "name": "Required data missing?",
      "type": "n8n-nodes-base.if",
      "position": [
        -3120,
        512
      ]
    },
    {
      "id": "e89b2169-b944-407b-a3c5-05b1ed6c66e8",
      "name": "Bad Request",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -2944,
        32
      ]
    },
    {
      "id": "b3b29fa8-89c6-42b4-9455-f6ed4110416f",
      "name": "Source ID Validation",
      "type": "n8n-nodes-base.code",
      "position": [
        -2512,
        176
      ]
    },
    {
      "id": "8c3852d9-bccc-41d6-8b44-ff22bbb9b458",
      "name": "Medium ID Validation",
      "type": "n8n-nodes-base.code",
      "position": [
        -2512,
        304
      ]
    },
    {
      "id": "28199eb1-83e3-45a5-b6e8-cb1bad911bdb",
      "name": "Campaign ID Validation",
      "type": "n8n-nodes-base.code",
      "position": [
        -2512,
        432
      ]
    },
    {
      "id": "ca35714a-9459-484f-8b42-f59f26286533",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2736,
        48
      ],
      "parameters": {
        "width": 368,
        "height": 544,
        "content": "## Get Marketing Data\n"
      }
    },
    {
      "id": "cbe239c6-de01-4d18-b523-bb856bf405bb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4016,
        240
      ],
      "parameters": {
        "width": 608,
        "height": 800,
        "content": "## How it works\n\n1) **Ingest**\n   - Webhook receives POST at the path above.\n   - Header Auth is required (`x-webhook-token`).\n\n2) **Validate**\n   - IF node checks required fields; if any is missing →"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Prepare Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Lead": {
      "main": [
        [
          {
            "node": "Execution Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execution Data": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Request": {
      "main": [
        [
          {
            "node": "Create Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UTM: Get Medium ID": {
      "main": [
        [
          {
            "node": "Medium ID Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UTM: Get Source ID": {
      "main": [
        [
          {
            "node": "Source ID Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Medium ID Validation": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Source ID Validation": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UTM: Get Campaign ID": {
      "main": [
        [
          {
            "node": "Campaign ID Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Campaign ID Validation": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Required data missing?": {
      "main": [
        [
          {
            "node": "Bad Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "UTM: Get Campaign ID",
            "type": "main",
            "index": 0
          },
          {
            "node": "UTM: Get Medium ID",
            "type": "main",
            "index": 0
          },
          {
            "node": "UTM: Get Source ID",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Webhook - Lead Webform": {
      "main": [
        [
          {
            "node": "Required data missing?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}