Dedupe Typeform leads in HubSpot with a leads database

By General Input

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.

Integrations

  • Typeform
  • General Input Database
  • HubSpot
  • Slack Bot

Type

Deterministic Code

Categories

  • Sales
  • Operations

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.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasoniMessage campaign console with pre-flight checks and delivery boardChat quality review board for LiveChat support leadsCompetitor LinkedIn ad watchlist with a permanent archiveLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agents