How it works
What this system does
One webhook, one visible field: the visitor's message. The workflow classifies intent with an AI agent, verifies the result with deterministic code, routes the lead to one of three offering branches (WEBSITE, AUTOMATION, MANAGED_IT), checks the salesperson's Google Calendar for free slots, drafts a reply with a second AI agent, and either sends it over SMTP or escalates to internal review. It is a single workflow, imports inactive, and starts in dry-run mode.
It is the message-only counterpart to the Intelligent Lead Routing & Response blueprint: a compact, self-contained intake and response layer that needs no CRM, database, or email-validation service.
From message to routed lead
An input gate stops empty, overly short (under 10 characters), or oversized (over 5,000 characters) submissions before any LLM or outbound request. The classifier returns structured JSON: offering_code, confidence, sender_email, sender_name, email_is_explicit, lead_stage, language, summary, reason, and needs_human.
"05 | Verify AI + Decide Route" then verifies the AI output deterministically: route allowlist, confidence floor (0.78 by default), a visitor email the model marks explicit that also appears inside the submitted text, human-review flags, and complete catalog configuration. Missing reply address, support requests, low confidence, and model failures route to internal review instead of a visitor reply; SPAM stops silently.
Availability and the reply
The matched route loads approved offering knowledge from the single setup catalog. Candidate business-hour slots are generated in the salesperson's timezone, checked with one Google Calendar FreeBusy request, and reduced to the confirmed free times. If the calendar lookup fails, no named slots are offered and the draft falls back to the booking link. A FreeBusy lookup is a snapshot, not a reservation - only the live booking link actually books a meeting.
The reply agent drafts only the subject and the body paragraph from the message and approved catalog facts. It cannot set the recipient, meeting times, booking URL, or signature; code assembles those deterministically and applies length and content safety checks before delivery. While dry_run is true, every draft goes to the internal team instead of the visitor.
Guardrails and limits
Both agent prompts treat form text as untrusted input, ignore prompt-injection attempts, stick to catalog facts, and avoid invented prices. The workflow does not implement rate limiting, idempotency, or CRM logging - protect the webhook with a spam-filtered backend, add deduplication, and keep dry run enabled until acceptance tests pass.
How to use
Before you start
- A compatible n8n instance; the export uses Webhook 2.1, Switch 3.4, and LangChain Agent 3.1 node versions.
- An OpenAI API credential. Models default to gpt-4.1-mini and can be swapped for another tool-capable model.
- A Google Calendar OAuth2 credential with access to the salesperson's calendar, plus a booking page synced to that calendar.
- An SMTP credential able to send from the configured company domain, with SPF, DKIM, and DMARC in place.
- Your approved offering catalog: scope, deliverables, exclusions, pricing policy, FAQs, reps, timezones, and booking URLs.
Import and configure
- Download the complete package, extract it, and read the full setup guide. Import the workflow JSON into n8n and save it.
- Attach credentials in the corresponding nodes: OpenAI for "Classifier - OpenAI Model" and "Sales Reply - OpenAI Model", Google Calendar OAuth2 for "09 | Google Calendar - Read FreeBusy" and "Sales Reply | Google Calendar Tool", and SMTP for "14A | SMTP - Send Customer Reply" and "15 | SMTP - Notify Sales Team". Secrets are never included in exported JSON.
- Open "02 | SETUP Company + Catalog" and replace every [REPLACE...] placeholder: company name, website, contact and verified sending addresses, then each offering's name, summary, deliverables, exclusions, pricing policy, FAQs, keywords, sales rep, calendar ID, booking URL, timezone, weekdays, candidate hours, and meeting length.
- Keep dry_run: true while testing. Drafts are emailed to the internal team, never to the visitor.
- Send submissions to the webhook path shown by "01 | Website Message Webhook" with a single JSON field: {"message": "..."}. The visitor's own reply address must explicitly appear inside the message, or the submission goes to review instead of receiving a reply.
Test before activating delivery
The supplied test payloads cover these scenarios:
| Scenario | Expected result |
|---|---|
| Website request with an email in the message | WEBSITE route when configured and confident; the draft goes to the internal team while dry_run=true. |
| CRM and n8n automation request | AUTOMATION route. |
| Ongoing IT and cloud support request | MANAGED_IT route. |
| Vague request with no clear product | Ambiguous - internal review. |
| Request without a reply address | Internal review, no visitor email. |
| Existing customer with a login problem | SUPPORT - internal review. |
| Empty, very short, or over 5,000 characters | Stopped before the LLM. |
| Promotional spam | SPAM stop. |
| Prompt-injection attempt | Untrusted text must not change routing or bypass the verified-email rules. |
| Rep calendar busy at a candidate time | That time must not appear in the proposed slots. |
| dry_run=true | No visitor-facing email is sent. |
Production hardening
Before using this with real visitors: put a rate-limited, spam-protected endpoint in front of the webhook; add idempotency (for example Redis SET NX or CRM-side event IDs); keep a lead audit record; configure an n8n error workflow; set SPF, DKIM, and DMARC; and add privacy/consent copy next to the form. Keep legal, security, and complaint topics on human review. Run the full checklist with credentials connected and dry_run: true, inspect every Code and Agent output, then set dry_run: false and activate the production webhook.
Customize the catalog
Each offering feeds from the single configuration node, but the routes are fixed. To rename a route code or add a fourth offering, also update the classifier output schema, the allowlist in "05 | Verify AI + Decide Route", the rules in "06 | Intent Switch", and add a branch into "08 | Generate Candidate Time Slots".
Validation status
The supplied validation report records static checks only. The workflow was not imported into or executed on an n8n instance; calendar, model, SMTP, and webhook behavior must be integration-tested with your own credentials and test inboxes before activation.
Related systems
Use the HubSpot Intelligent Lead Routing & Response System when intake must create or update CRM contacts with validation and scoring. The GA4 & HubSpot Lead Attribution System preserves source evidence for existing contacts, the HubSpot Duplicate Detection & Approved Merge System reviews duplicate records, the HubSpot Ghosted Proposal Follow-Up & Recovery System recovers quiet proposals, and the HubSpot Weekly Sales Pipeline Digest reports pipeline activity weekly. Configure each package separately; importing them together does not connect their webhooks or credentials.