๐ŸŽฃ Secure web form to Odoo CRM lead creation with UTM tracking

โšก 2,310 views ยท ๐ŸŽฃ Lead Generation & Enrichment

Description

Web-to-Odoo Lead Funnel (UTM-ready)

Create crm.lead records in Odoo from any webform via a secure webhook.
The workflow validates required fields, resolves UTMs by name (source, medium, campaign) and writes standard lead fields in Odoo. Clean, portable, and production-ready.

Key features

Prerequisites

How it works

  1. Ingest โ€“ The Webhook receives a POST at /webhook(-test)/lead-webform with Header Auth.
  2. Validate โ€“ An IF node checks required fields; if missing โ†’ respond with 400 Bad Request.
  3. UTM lookup โ€“ Three Odoo getAll queries fetch IDs by name:
    • utm.source โ†’ source_id
    • utm.medium โ†’ medium_id
    • utm.campaign โ†’ campaign_id
      If a record is not found, the corresponding ID remains null.
  4. Consolidate โ€“ Merge + Code nodes produce a single clean object:
    { name, contact_name, email_from, phone, description, type: "lead", campaign_id, source_id, medium_id }
  5. Create in Odoo โ€“ Odoo node (crm.lead โ†’ create) writes the lead with standard fields + UTM Many2one IDs.
  6. Respond โ€“ Success node returns 200 with { status: "ok", lead_id }.

Payload (JSON)

Required: firstname, lastname, email
Optional: phone, notes, source, medium, campaign

{
  "firstname": "John",
  "lastname": "Doe",
  "email": "john.doe@example.com",
  "phone": "+393331234567",
  "notes": "Wants a demo",
  "source": "Ads",
  "medium": "Website",
  "campaign": "Spring 2025"
}

Quick test

curl -X POST "https://<host>/webhook-test/lead-webform" \
  -H "Content-Type: application/json" \
  -H "x-webhook-token: <secret>" \
  -d '{"firstname":"John","lastname":"Doe","email":"john@ex.com",
       "phone":"+39333...", "notes":"Demo",
       "source":"Ads","medium":"Website","campaign":"Spring 2025"}'

Notes

๐Ÿ”— Nodes Used

Webhook, Odoo, Execution Data

๐Ÿ“ฅ Import

Download workflow.json and import into n8n: Workflow menu โ†’ Import from File

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup