Knowledge Base

Build Lead Cleanup → CRM Workflow

Duration: ~15 min · Level: Beginner · Template: #264 Lead Cleanup → CRM · Deployment: Cloud or Studio (webhook + HubSpot)

Prerequisites: A HubSpot private app / access token with contact write scope; one-time SQLite file cleaned_leads.db; any form, ads, or CSV importer that can POST JSON to a webhook.

Stop sales from fixing lead data by hand: accept leads from any source, normalize emails and company names, skip duplicates, and only then create a HubSpot contact.

What this template does

  1. Incoming Lead — webhook POST with email, firstName, lastName, company, source.
  2. Normalize + Dedupe Check — trim/lowercase email; look up existing row in cleaned_leads.
  3. New or duplicate? — duplicates stop; new leads continue.
  4. Company aliases — value mapper standardizes common name variants.
  5. Create HubSpot Contact — then write the cleaned row back to SQLite for the next dedupe.

Step 1 — Create cleaned_leads.db

CREATE TABLE cleaned_leads(
  email TEXT PRIMARY KEY,
  first_name TEXT,
  last_name TEXT,
  company TEXT,
  lead_source TEXT,
  updated_at TEXT
);

Step 2 — Load template #264

  1. Open Studio → Templates (or empty-canvas recipe Before leads hit the CRM…).
  2. Search Lead Cleanup and load template #264.

Step 3 — Webhook, mapper, HubSpot

  1. Note the webhook token/URL from Incoming Lead; point forms or importers at it.
  2. Extend the company Value Mapper with your aliases (e.g. Acme Inc → Acme).
  3. Paste the HubSpot access token on Create HubSpot Contact.

Step 4 — Test with curl

curl -X POST "https://YOUR_HOST/webhook/lead-intake" \
  -H "Content-Type: application/json" \
  -d '{"email":" [email protected] ","firstName":"Ada","lastName":"Lovelace","company":"Acme Inc","source":"Landing"}'

First call should create a HubSpot contact; a second identical email should be treated as a duplicate.

Related

Nodlyn Assistant
Ask me anything about Nodlyn
Hi! 👋 I'm the Nodlyn assistant. Ask me about the product, workflow components, connectors, agent runtime, agent capabilities, deployment, and more. If I don't know an answer, I'll point you to our contact form.