AI Lead Intake CRM Automation

A portfolio-ready automation system built with n8n, Airtable, Telegram Bot API and webhooks. It receives incoming lead data, normalizes and validates it, prevents duplicates, stores clean records, logs operational events and sends Telegram notifications for new valid leads.

0
Test scenarios
0
Airtable tables
0
Logged event types
All scenarios passed
Overview

Project Overview

A lightweight CRM intake pipeline for service businesses that need reliable lead capture without manual duplicate checking or missed notifications.

n8nAirtableTelegram Bot APIWebhooks
POST /webhook/ai-lead-intake-test
POST /webhook/ai-lead-intake-test { "name": "Final Matrix New Lead", "email": "final.matrix.new@example.com", "business_type": "Beauty Booking" } 200 OK { "status": "success", "message": "Lead created" }
Problem

Why this exists.

01

Manual lead handling

Incoming leads often need to be copied into a CRM manually, which creates delays and inconsistent data quality.

02

Duplicate pollution

Repeated submissions can create multiple records for the same contact unless the system checks normalized identifiers.

03

No observability

Without operational logs, it is difficult to know which requests succeeded, failed validation, or were rejected as duplicates.

Solution

Clean intake, every time.

The workflow accepts a JSON webhook request, cleans the data, validates required fields, checks Airtable for existing leads, writes clean records, logs every outcome and sends focused Telegram notifications only for new valid leads.

Validation

Email is required before the lead can enter the CRM. Invalid submissions are logged and rejected with a structured JSON response.

Duplicate prevention

Email values are trimmed and converted to lowercase before lookup, preventing duplicate records caused by casing or whitespace.

🔔

Notification discipline

Telegram alerts are sent only for actionable new leads. Duplicates and validation errors are logged without creating notification noise.

Architecture

One pipeline, four paths.

The main workflow branches into success, duplicate and validation-error paths. A separate error handler workflow catches unexpected workflow failures. Click any stage to inspect it.

WebhookPOST · lead ValidateIF · email CreateAirtable Telegramnotify Log · reject422 · fail fast
Click a node to inspect it

The signal flows Webhook → Validate, then branches to Create + Telegram on success, or Log · reject on failure.

Main success path

Receive Lead Webhook → Normalize Lead Data → Validate Email Exists → Search Existing Lead by Email → Check Duplicate Found → Create Lead in Airtable → Log Successful Lead Creation → Notify New Lead via Telegram → Respond Success.

Duplicate path

If an existing Airtable record is found by normalized email, the workflow writes a duplicate log and returns a duplicate JSON response. No new lead record is created and no Telegram notification is sent.

Missing email path

If email is missing after normalization, the workflow writes a missing_email log and returns an error JSON response. No CRM lead is created.

🛡

Error handler workflow

A separate workflow uses an Error Trigger and writes workflow_error events to the Automation_Logs table when the main workflow fails unexpectedly.

Database

Airtable Data Model

Two Airtable tables separate business data from operational history.

Leads_clean
FieldPurpose
NameLead contact name
EmailNormalized lookup identifier
PhoneContact number
Business CategoryLead business type
CityLead location
MessageOriginal request context
Created AtAutomatic timestamp
Automation_Logs
FieldPurpose
Statussuccess / duplicate / error
EmailRelated normalized email
NameLead name when available
Event Typelead_created, duplicate_lead, missing_email, workflow_error
MessageHuman-readable event detail
Sourcewebhook or n8n_error_trigger
Normalization Logic

Production-safe field mapping.

The workflow reads incoming values from the webhook body and maps them into clean internal fields.

field mapping
lead_name: {{ ($json.body?.name || "").trim() }} lead_email: {{ ($json.body?.email || "").trim().toLowerCase() }} lead_phone: {{ ($json.body?.phone || "").trim() }} lead_business_type: {{ ($json.body?.business_type || "").trim() }} lead_city: {{ ($json.body?.city || "").trim() }} lead_message: {{ ($json.body?.message || "").trim() }}
Test Matrix

Final Test Matrix

The system was verified with the production webhook endpoint, not the manual test endpoint.

ScenarioExpected ResultStatus
New leadLead created, success log written, Telegram sent, success response returned✓ Passed
Duplicate leadNo new lead created, duplicate log written, duplicate response returned✓ Passed
Missing emailNo lead created, missing_email log written, error response returned✓ Passed
Normalized duplicateUppercase/spaced email normalized and detected as duplicate✓ Passed
JSON Responses

Structured JSON Responses

Every path returns a predictable response for API consumers.

success
{ "status": "success", "message": "Lead created", "email": "final.matrix.new@example.com" }
duplicate
{ "status": "duplicate", "message": "Lead already exists", "email": "final.matrix.new@example.com" }
error
{ "status": "error", "message": "Email is required" }
Proof, not mockups

Screenshot Evidence

Real screenshots from the completed build. ReqBin responses are documented as structured JSON cards above, so a separate ReqBin screenshot is not required. All visible records use sample/demo data created for this portfolio case study.

Main n8n workflow
Main n8n workflow

Webhook → normalization → validation → duplicate prevention → Airtable → logs → Telegram → response

Airtable Leads_clean
Airtable Leads_clean

Validated, normalized lead records stored in CRM table

Airtable Automation_Logs
Airtable Automation_Logs

Operational event history for success, duplicate, validation error and workflow error

Telegram notification
Telegram notification

New valid leads trigger a clean operational alert

Error Handler workflow
Error Handler workflow

Separate workflow captures unexpected failures and logs workflow_error events

Notes

Production Notes & Limitations

This is a portfolio-ready automation system, not a full enterprise CRM platform.

Current limitations

  • Webhook is not protected with authentication.
  • Telegram notification still runs inside the success path.
  • Email format validation is basic.
  • Phone normalization is limited.
  • No public frontend form in this version.
  • Local build, not public cloud deployment.
🔧

Future improvements

  • Add webhook authentication.
  • Add stronger email format validation.
  • Normalize phone numbers.
  • Move Telegram notifications to an async workflow.
  • Add public lead form.
  • Deploy n8n to cloud or VPS.
  • Add dashboard metrics.
Skills Demonstrated

Beyond simple tool usage.

This project demonstrates automation engineering thinking beyond simple tool usage.

Automation Architecture

Designed branch logic for success, duplicate and validation-error paths.

🔗

API & Webhooks

Handled JSON requests through a production webhook endpoint and returned structured responses.

🧹

Data Quality

Applied normalization before validation and duplicate lookup to reduce bad CRM records.

👁

Observability

Added event logging for success, duplicate, validation error and workflow error outcomes.

🔌

Integration

Connected n8n, Airtable and Telegram Bot API into a coherent operating system.

🧪

Testing Discipline

Validated the workflow with a final scenario-based test matrix.

×Enlarged proof screenshot