AWS Builder Center
Solving the Inbound Lead Nightmare: Architecting an AI Triage Pipeline with n8n and LLMs

Solving the Inbound Lead Nightmare: Architecting an AI Triage Pipeline with n8n and LLMs

"B2B sales teams lose high-value deals when reps spend hours sorting enterprise buyers from free-trial seekers. This event-driven automation solves the bottleneck in under 5 seconds. Using n8n, custom JavaScript, and Google Gemini, it ingests website form leads, filters personal domains, evaluates Ideal Customer Profile (ICP) fit, and drafts a custom sales pitch. Hot leads trigger an interactive Slack card with 1-click CRM approval, cutting response time from 4 hours to seconds."

Student

Introduction

In B2B sales, responding quickly to potential customers can make a significant difference. However, sales teams often waste valuable time manually reviewing leads, identifying enterprise buyers, and preparing personalized responses.
To solve this problem, I worked on an AI-powered lead triage pipeline using n8n, JavaScript, and Google Gemini.
The goal is to automate lead qualification, identify high-value prospects, and help sales teams respond faster through an interactive Slack approval system.

The Problem

Traditional lead management involves several repetitive tasks:
  • Reviewing incoming website form submissions.
  • Filtering personal email domains.
  • Identifying potential enterprise customers.
  • Evaluating Ideal Customer Profile (ICP) fit.
  • Preparing personalized sales pitches.
These manual processes can delay responses and cause valuable opportunities to be overlooked.

The Proposed Solution

I designed an event-driven automation workflow using n8n that combines rule-based processing with AI-powered decision-making.
The workflow follows this architecture:
Website Form → n8n Webhook → JavaScript Filtering → Google Gemini → Lead Classification → Slack Approval → CRM
Each component handles a specific task, making the automation modular and easier to maintain.

Technology Stack

  • n8n: Workflow automation and orchestration.
  • JavaScript: Custom data processing and email-domain filtering.
  • Google Gemini: AI-based lead evaluation and personalized pitch generation.
  • Slack: Interactive notifications and human approval.
  • CRM: Managing approved leads.

How the Automation Works

1. Lead Capture

The workflow starts when a user submits a website form. An n8n Webhook captures the information, including name, email, company, and business requirements.

2. Email Filtering

Custom JavaScript logic identifies personal email domains such as Gmail and Yahoo, helping separate potential business leads from other submissions.

3. AI-Powered Lead Qualification

The filtered lead information is sent to Google Gemini, which evaluates the prospect based on company relevance, business requirements, and ICP alignment.
The model generates a structured assessment containing lead classification, reasoning, and recommended actions.

4. Personalized Sales Pitch

Gemini generates a contextual sales pitch based on the prospect's available information, helping sales representatives avoid generic communication.

5. Slack Approval

High-priority leads trigger an interactive Slack notification containing the lead details, AI assessment, and generated pitch.
Sales representatives can review the recommendation and approve or reject the lead.

6. Human-in-the-Loop CRM Integration

Approved leads proceed to the CRM integration, while rejected leads are prevented from being submitted.
This ensures that important business decisions remain under human control.

Why n8n?

n8n makes it possible to connect multiple services through a visual workflow without building every integration from scratch.
Its support for webhooks, conditional logic, custom JavaScript, and API integrations makes it suitable for building AI-powered automation systems.
It also allows developers to monitor, debug, and extend workflows more easily.

Key Takeaways

Working on this project helped me explore how traditional automation and Large Language Models can work together to solve practical business problems.
Some important considerations include:
  • Validating incoming data before processing.
  • Handling inconsistent AI responses.
  • Preventing incorrect lead classifications.
  • Maintaining human approval for important actions.
  • Managing API failures and workflow reliability.

Conclusion

This project demonstrates how n8n, JavaScript, and Google Gemini can transform manual lead qualification into an intelligent automation pipeline.
By combining deterministic logic, AI-powered evaluation, and human approval, the system aims to reduce repetitive work and help sales teams prioritize valuable opportunities.
My key takeaway is that effective AI automation is not just about using an LLM; it is about integrating intelligence into a reliable workflow that solves a real-world problem.
Tech Stack: n8n | JavaScript | Google Gemini | LLMs | Slack | Webhooks | CRM Automation
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article