See llms.txt for all machine-readable content.

Back to Templates

Score and route web form leads using Claude Haiku, HubSpot and Slack

Quick overview

This workflow receives website form leads via webhook (or runs with sample payloads), uses Anthropic Claude Haiku to classify intent from the message, scores and tiers each lead, then upserts contacts in HubSpot, optionally alerts sales in Slack for Tier A, and logs outcomes to an n8n Data Table.

How it works

  1. Receives a form submission via a webhook (or you can run a manual trigger that generates 20 sample payloads).
  2. Normalizes the incoming fields, validates email format, detects common prompt-injection patterns, and keeps invalid leads with a reason instead of dropping them.
  3. Sends the free-text message to Anthropic Claude Haiku to extract structured intent, timeframe, use case, and an injection flag.
  4. Combines the validated fields and Claude output to compute a lead score, assign a tier (A/B/C) with human-readable reasons, and zero-scores anything flagged as injection.
  5. Runs a final consistency check and, if it passes, upserts the contact in HubSpot with five custom properties and records whether the HubSpot sync succeeded.
  6. Routes Tier A leads to a Slack alert (if enabled) and routes Tier B/C leads into HubSpot nurture lists, while work-email leads also trigger a HubSpot company lookup by domain and company creation if missing.
  7. Inserts every processed lead (including invalid or failed HubSpot syncs) into an n8n Data Table log and outputs a scorecard summarizing routing, drops, injections, and HubSpot errors.

Setup

  1. Add an Anthropic credential for the Claude Haiku model in the Anthropic chat model node.
  2. For live HubSpot routing, add a HubSpot private app token (Contacts, Companies, and Lists scopes) to all HubSpot nodes, unpin the sample data, and create the five contact properties: lead_score, lead_tier, fit_reasons, intent, use_case.
  3. Update the HubSpot list IDs used for Tier B and Tier C in the nurture-list step to match your static lists.
  4. Optional: add a Slack credential, enable the Slack alert step, set your target channel, and replace YOUR_PORTAL_ID in the HubSpot record link.
  5. Optional: create an n8n Data Table named lead_log with the columns email_domain, tier, score, fit_reasons, intent, and dropped_reason for persistent logging.
  6. To use the webhook trigger, enable it and copy the webhook URL (path: /webhook/lead-intake) into your form tool so it POSTs the expected fields (email, name, company, country, team_size, message).