What this workflow does
- New lead message accepts
{email, name, company, message, source}from your form or chat tool. Lead email reply picks up the lead’s replies to the agent’s emails. - Normalize inbound turns both into one shape and strips quoted history from email replies.
- HubSpot: find contact loads the contact’s stored answers, transcript and status. Leads whose conversation already ended are left to the person who owns them.
- Build agent turn tells Claude what is already known and what is still open, so the agent never re-asks. The prompt requires an AI disclosure on the first reply and forbids prices, terms and meeting promises.
- Claude: next reply returns the reply plus structured answers with fixed values for timeline, company size, budget band and decision role, and flags for “wants a human” and “off topic”.
- Score and decide merges answers without overwriting known values, strips any reply that mentions a dollar amount, and applies a versioned scoring function: tier A books with your booking link, tier B hands off to a rep, tier C goes to nurture, and disqualified leads get a courteous close. After four turns it hands off whatever it has.
- HubSpot: save answers writes answers, transcript, status and tier to the contact.
- Next action sends replies with Email the lead, and shadow-mode drafts and errors to Notify sales. Handoffs do both: the lead gets a fixed acknowledgment by email, even in shadow mode, and sales gets the summary in Slack.
Before you import
- A current n8n version.
- HubSpot with a private app token that can read and write contacts, and four custom contact properties:
lumeor_qual_answers,lumeor_qual_transcript(multi-line text),lumeor_qual_statusandlumeor_qual_tier. - A Gmail or Google Workspace mailbox the agent sends from.
- An Anthropic API key and a Slack bot for your sales channel.
Setup
- Import the JSON file and connect the credentials. Both HubSpot nodes use the same private app token credential.
- In Build agent turn, replace
REPLACE_WITH_COMPANY_NAMEandREPLACE_WITH_ONE_SENTENCE_ABOUT_YOUR_OFFER. - In Score and decide, replace the company name and
REPLACE_WITH_BOOKING_LINK, and adjust thescorefunction to match the rubric your sales lead signed off. - Replace
REPLACE_WITH_SALES_CHANNELin Notify sales. - Point your website form or chat tool at the production webhook URL with the Header Auth header.
Test it
Leave SHADOW_MODE on. Post a form message such as “We need help automating accounts payable” from a test address. Slack should show a draft that introduces itself as an AI assistant and asks one or two questions, and the HubSpot contact should have answers and a transcript. Post a second message with timeline, team size, budget band and your role, and confirm the tier and status change in HubSpot and the Slack draft contains the booking link for an A-tier lead.
Make it production-ready
- Shadow mode first. Review drafts for one to two weeks, compare tiers with what reps decide after the first call, then set
SHADOW_MODEto false. - Error workflow. Set one so a HubSpot or Gmail failure never leaves a lead unanswered.
- Follow-ups. Add a scheduled flow that nudges leads in
qualifyingstatus after two days of silence, at a cadence you approve. - Routing. Use owner rules or round robin for handoffs instead of one channel.
- SMS. Add Twilio only after consent capture and 10DLC registration are in place.
- Model choice.
claude-haiku-5-5is a cheaper option for simple qualification at high volume.
Read the full guide, how to build an AI lead qualification agent, see the lead enrichment template to fill answers before the first reply, or talk to Lumeor.