Dedupe Typeform leads in HubSpot with a leads database
When a Typeform response arrives, check your leads database, create the HubSpot contact only if the email is new, and post a color-coded Slack alert to the team.
Build me a deterministic code workflow that deduplicates inbound Typeform leads against a leads table in my General Input Database, so the same person filling out multiple forms only becomes one HubSpot contact.
Trigger: a Typeform outgoing webhook that fires on every new form response. Use Typeform's Create or Update Webhook operation to register the webhook on the form, then have the workflow receive that incoming HTTP request.
When a response arrives, parse the email, first name, last name, and company fields out of the Typeform payload. Lowercase and trim the email and use it as the dedupe key. Also capture the form ID and form title from the payload.
Use the General Input Database (Execute SQL). Create a leads table on first run if it does not exist with columns: email TEXT PRIMARY KEY, first_seen_at DATETIME, last_seen_at DATETIME, source_form_id TEXT, resubmit_count INTEGER DEFAULT 0, owner_slack_user_id TEXT. Remember this is SQLite syntax.
Run a SELECT against the leads table for the lowercased email.
If no row exists (new lead branch): INSERT a row with first_seen_at = now, last_seen_at = now, source_form_id from the webhook, resubmit_count = 0. Then call HubSpot Create Contact with email, firstname, lastname, company, and lifecycle_stage set to "lead". Then post a green-themed message to a configurable Slack channel using Slackbot Send a Message that reads something like: New lead: {name} ({email}) from {company} via form {form_title}. Use Slack attachment color green or a green block accent.
If a row already exists (returning lead branch): skip the HubSpot Create Contact step entirely so we do not create a duplicate. UPDATE the leads row: last_seen_at = now, resubmit_count = resubmit_count + 1. Then post a yellow-themed Slackbot Send a Message: Returning lead: {name} ({email}), first seen {N} days ago, now {count} submissions. If owner_slack_user_id is set on the row, tag that user in the message. Use Slack attachment color yellow.
Use the Slackbot integration (not user Slack) so the messages post as a workspace bot, which is what teams expect for automated lead alerts.
At the end of every run, log a one-line summary (new vs returning, email, form ID) so the run history is easy to scan. Make the Slack channel ID, Typeform form IDs, and HubSpot lifecycle stage configurable inputs so I can change them without editing code.
Additional information
What does this prompt do?
- Listens for every new Typeform response and routes it through one central leads list before anything else happens.
- Creates a fresh HubSpot contact only when the email has never been seen, so your CRM stays clean across every form you run.
- Posts a green New lead or yellow Returning lead message to Slack so your team can tell new from recurring at a glance.
- Tracks how many times each person has resubmitted, plus the first and last time you heard from them.
What do I need to use this?
- A Typeform login that can add webhooks to your forms.
- A HubSpot login that can create contacts.
- A Slack workspace plus the channel that should receive the lead alerts.
- Your General Input Database (the workflow uses a leads table inside it as the single source of truth).
How can I customize it?
- Choose which Typeform fields map into HubSpot (lifecycle stage, source, company, phone, and any custom properties).
- Pick the Slack channel that receives alerts, or split new vs returning leads into two channels.
- Tune the returning-lead rule, for example only ping the team if the previous submission was more than 30 days ago.
- Point it at multiple Typeform forms at once so every form rolls up into the same deduped list.
Frequently asked questions
Will this actually stop duplicate contacts in HubSpot?
What happens when the same person fills out a second form?
Can I point this at more than one Typeform form?
What if someone changes their email between submissions?
Do I have to build the leads table myself?
Stop letting the same lead become three HubSpot contacts.
Connect Typeform, HubSpot, Slack, and your General Input Database once, and every form submission gets routed through one source of truth.