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
- Incoming Lead — webhook
POSTwithemail,firstName,lastName,company,source. - Normalize + Dedupe Check — trim/lowercase email; look up existing row in
cleaned_leads. - New or duplicate? — duplicates stop; new leads continue.
- Company aliases — value mapper standardizes common name variants.
- 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
- Open Studio → Templates (or empty-canvas recipe Before leads hit the CRM…).
- Search
Lead Cleanupand load template #264.
Step 3 — Webhook, mapper, HubSpot
- Note the webhook token/URL from Incoming Lead; point forms or importers at it.
- Extend the company Value Mapper with your aliases (e.g.
Acme Inc→Acme). - 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
- Webhook Trigger.
- Blog: Lead cleanup before CRM.
- Blog: Salesforce CRM records — same pattern for Salesforce instead of HubSpot.
- Use case: CRM Lead Cleanup.