All Templates
Revenue Operations • Advanced • 1 n8n workflow

AI Inbound Lead Routing & Sales Follow-Up System

A single-message inbound webhook that classifies intent with AI, verifies the result in code, routes leads across three offerings, checks Google Calendar availability, and either sends a drafted reply over SMTP or escalates it to internal review. Imports inactive in dry-run mode and needs no CRM, database, or validation service.

0

One system, 1 connected workflow

Start with the complete package and setup directions. The preview below shows the entry workflow. Import every listed workflow separately, then connect their references in your n8n instance.

Get the workflow Read the setup directions

Entry workflow preview

Powered by n8n.io

Read the architecture, decision rules, and exception handling in the source blueprint .

Continue with the related architecture guide .

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

  1. Download the complete package, extract it, and read the full setup guide. Import the workflow JSON into n8n and save it.
  2. 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.
  3. 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.
  4. Keep dry_run: true while testing. Drafts are emailed to the internal team, never to the visitor.
  5. 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:

ScenarioExpected result
Website request with an email in the messageWEBSITE route when configured and confident; the draft goes to the internal team while dry_run=true.
CRM and n8n automation requestAUTOMATION route.
Ongoing IT and cloud support requestMANAGED_IT route.
Vague request with no clear productAmbiguous - internal review.
Request without a reply addressInternal review, no visitor email.
Existing customer with a login problemSUPPORT - internal review.
Empty, very short, or over 5,000 charactersStopped before the LLM.
Promotional spamSPAM stop.
Prompt-injection attemptUntrusted text must not change routing or bypass the verified-email rules.
Rep calendar busy at a candidate timeThat time must not appear in the proposed slots.
dry_run=trueNo 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.

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.

Get the complete automation system

Download the workflow and the supporting files together. Extract the ZIP, then import the workflow JSON listed below separately. Configuration, source code, and other supporting files are not n8n workflow imports.

Download complete package (ZIP)

1 connected n8n workflow

It imports inactive. Follow the package setup directions before activating schedules or delivery.

  1. Message-only AI lead routing workflow

    One webhook classifies intent, verifies the email and confidence in code, routes to the matched offering, checks Google Calendar availability, drafts the reply and either sends it over SMTP or escalates to internal review.

    message-only-ai-lead-routing.n8n.json
    Download workflow 01

Setup, integration, and validation files

  • Complete setup guide

    Configuration fields, credential binding, message contract, test scenarios, and the production hardening checklist.

    README.md
  • Test payloads

    Example webhook bodies for each offering, ambiguous, missing-address, support, spam, and prompt-injection scenarios.

    test-payloads.json
  • Supplied validation report

    Static structure checks and file hashes. Live n8n, model, calendar, and SMTP behavior was not executed.

    validation-report.txt