How to Build an AI Agent for Lead Qualification (n8n)

5 min node by node: website form webhook, AI scores lead and intent, log all to Google Sheets CRM, Slack alert if score 7+. Free JSON. Short but clear.

playbook
Last updated Nov 21, 2026

Tools featured in this playbook

This article was originally posted on YouTube

Here is how to build an AI agent for lead qualification in n8n.

Why event-driven, not polling

Most people building automation start with a cron job. Every 15 minutes, check if something changed. Every hour, pull the API. It works, until you're running it 96 times a day just to catch the one moment something actually happened.

Production systems don't poll, they react. A form gets submitted, a payment clears, a row gets updated, and the automation fires the instant it happens.

The 3 event sources you'll use constantly

An event source is anything that can tell your automation "something just happened".

  1. Webhooks. The most universal event source. Any tool that can send an HTTP request can ping your workflow the second something happens: website forms, payment processors, chat platforms. If it has a webhook option, you never need to poll it.

  2. App triggers. The pre-built, app-specific version of a webhook. The app node listens for you: a new Typeform submission, a new Calendly booking, a new Stripe charge. Same idea, less setup.

  3. Database updates. When the event is a row that changed, a status that flipped or a new record. Airtable, Postgres and Google Sheets all have trigger nodes that watch for row-level changes.

All three are interchangeable at the front of your pipeline. Everything downstream stays exactly the same. You just plug a different trigger into the same pipe.

The pipeline

Website form → webhook → AI analysis → CRM entry → Slack alert.

Someone fills out a form on your website. That fires a webhook. AI analyzes the message, scores the lead, detects intent and urgency, then logs everything in your CRM. Only if the lead is hot does your team get alerted.

The workflow, node by node

1. Webhook: website lead form

This is the event source. It listens on a POST endpoint. Copy the production URL and point your website form at it. For the demo, I pinned two sample submissions on this node, a hot lead and a cold one, so we can see both outcomes.

2. AI: analyze lead

It takes the name, email, company and message, and returns a structured judgment:

  • A lead score out of 10

  • The intent behind the message

  • Urgency

  • A one-line summary a salesperson can skim in 2 seconds

3. Code: parse lead analysis

The raw AI output gets cleaned up here. The node pulls the original form fields back in and normalizes everything into one flat object: timestamp, name, email, company, message, lead score, intent, urgency, summary.

4. Google Sheets: CRM entry

Every single lead, hot or not, gets logged to Google Sheets. This is the system of record. Nothing gets lost.

5. If: hot lead

Is the lead score 7 or higher?

  • Yes: it goes to the Slack hot lead alert, a real-time ping to the channel with the lead's name, company and the AI-written summary.

  • No: nothing happens. No Slack message, no interruption. The lead already sits in the CRM sheet.

Not every event deserves a notification. Every lead gets logged, only the hot ones interrupt a human. That is what separates a useful automation from one that just adds noise.

A handy pattern in the Slack node

Instead of pulling name, company, summary and urgency from the Sheets output, the Slack node reaches back and reads them straight from the "Code: parse lead analysis" node. You're not stuck with whatever the last node returned. You can always reach back to an earlier node by name.

Comments

Login to leave a comment