DEV Community

KrisYing
KrisYing

Posted on

Building an AI Voice Agent Pipeline with n8n — Analyze Calls, Score Leads, Alert in Real-Time

Voice AI is having a moment. Upwork reported a +329% year-over-year surge in voice agent project postings in early 2026. But here's what most tutorials miss: the call itself is only half the story. What happens after the call — extracting intent, scoring the lead, alerting your sales team, logging to CRM — that's where the business value actually lives.

This article walks through a production-grade post-call intelligence pipeline built entirely with n8n. No custom infrastructure, no glue code — just a workflow you can import and activate in minutes.


The Architecture

The pipeline connects five stages in a single n8n workflow:

[Vapi / Retell / Synthflow]
        ↓  webhook (call ended event)
[n8n Webhook Node]
        ↓  raw transcript + metadata
[AI Analysis Node — DeepSeek/OpenAI]
        ↓  structured JSON: intent, score, sentiment
[IF Node — leadScore >= 7 AND qualifiedLead = true]
    ↓ YES                        ↓ NO
[Slack Alert]              [Low-priority log]
        ↓
[Google Sheets — CRM Log]
Enter fullscreen mode Exit fullscreen mode

Compatible voice platforms: Vapi, Retell AI, Synthflow, Bland.ai — any platform that sends a webhook on call completion with the transcript in the payload.

The webhook payload typically looks like this (Vapi example):

{
  "type": "call-ended",
  "call": {
    "id": "call_abc123",
    "duration": 187,
    "transcript": "Agent: Hi, thanks for calling Apex Realty...\nCaller: Yes, I'm looking to buy...",
    "phoneNumber": "+14155551234",
    "metadata": {
      "campaign": "google-ads-q1"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Section 1: Receiving and Parsing the Call Event

The n8n Webhook node listens at a path like /voice-agent/call-ended. Set it to POST, respond immediately with 200 OK (don't make the voice platform wait), then pass the payload downstream.

A Code node extracts the fields you need before hitting the AI:

const call = $input.item.json.call;
return [{
  json: {
    callId: call.id,
    duration: call.duration,
    transcript: call.transcript,
    phoneNumber: call.phoneNumber,
    campaign: call.metadata?.campaign ?? "unknown"
  }
}];
Enter fullscreen mode Exit fullscreen mode

Section 2: AI Transcript Analysis — The Intelligence Layer

This is where the real work happens. An HTTP Request node (or the native OpenAI node) sends the transcript to your model with a structured extraction prompt:

You are a sales intelligence analyst. Analyze this call transcript and return ONLY valid JSON.

Extract:
- callerIntent: one of [buying, selling, renting, refinancing, pricing_inquiry, scheduling, complaint, general_inquiry]
- sentiment: one of [positive, neutral, negative]
- urgency: one of [immediate, within_month, exploring, unknown]
- leadScore: integer 1-10 (10 = ready to buy/commit now)
- qualifiedLead: boolean (true if they have budget, authority, need, and timeline)
- actionItems: array of strings (what the sales team should do next)
- summary: one-sentence summary of the call

Transcript:
{{transcript}}
Enter fullscreen mode Exit fullscreen mode

The model returns clean JSON like:

{
  "callerIntent": "buying",
  "sentiment": "positive",
  "urgency": "within_month",
  "leadScore": 8,
  "qualifiedLead": true,
  "actionItems": [
    "Send 3-bedroom listings in Maplewood under $650K",
    "Schedule follow-up call for Thursday afternoon"
  ],
  "summary": "Caller is pre-approved for $650K, actively searching, prefers Maplewood area."
}
Enter fullscreen mode Exit fullscreen mode

The 8 callerIntent types were tuned across hundreds of real estate and SaaS sales calls. Getting intent classification right is critical — it determines downstream routing, not just the lead score.


Section 3: Routing Logic — The IF Node

n8n's IF node evaluates two conditions with AND logic:

Condition Operator Value
{{ $json.leadScore }} Greater than or equal to 7
{{ $json.qualifiedLead }} Equal to true

True branch (hot lead): Triggers the Slack alert immediately.
False branch (cold/warm lead): Writes to Google Sheets for later follow-up without pinging anyone.

The Slack message template:

*Hot Lead Alert* — Score: {{ $json.leadScore }}/10
Phone: {{ $json.phoneNumber }} | Campaign: {{ $json.campaign }}
Intent: {{ $json.callerIntent }} | Urgency: {{ $json.urgency }}
Summary: {{ $json.summary }}
Next steps: {{ $json.actionItems.join(', ') }}
Enter fullscreen mode Exit fullscreen mode

Sales reps get a fully contextualized brief in Slack within seconds of the call ending — no listening to recordings, no manual CRM entry.


Section 4: Why DeepSeek Makes This Viable at Scale

Running AI analysis on every inbound call has a cost problem at OpenAI prices:

Model Input cost per 1M tokens 10,000 calls/month (~500 tokens avg)
GPT-4o $5.00 ~$25/month
GPT-4 Turbo $10.00 ~$50/month
DeepSeek V3 $0.14 ~$0.70/month

For a real estate agency handling 300 calls/day, DeepSeek cuts AI analysis costs from $450/month to under $13/month with comparable extraction quality on structured tasks like this. The prompt above works without modification on any OpenAI-compatible endpoint — just swap the base URL:

Base URL: https://api.deepseek.com/v1
Model: deepseek-chat
API Key: your-deepseek-key
Enter fullscreen mode Exit fullscreen mode

Section 5: Real-World Use Cases

Real estate agencies — Score buyer/seller intent, auto-assign leads to agents by territory, trigger listing alerts to hot buyers within minutes of the call.

SaaS sales teams — Detect trial-to-paid signals, flag churn risk calls for CS intervention, log MEDDIC qualification fields to HubSpot automatically.

Healthcare appointment booking — Extract appointment type, insurance mentioned, urgency level. Route to the correct specialist's calendar without front-desk intervention.

Legal intake — Classify case type (personal injury, family law, criminal), assess case strength signals, prioritize callbacks for high-value case types.

In each scenario the workflow is identical — only the callerIntent taxonomy and routing rules change. That's the composability advantage of building in n8n rather than hard-coding a custom integration.


The Google Sheets CRM Log

Every call — hot or cold — gets logged to a Google Sheets row via the Google Sheets node:

Column Source
Timestamp {{ $now }}
Call ID {{ $json.callId }}
Phone {{ $json.phoneNumber }}
Duration (s) {{ $json.duration }}
Intent {{ $json.callerIntent }}
Score {{ $json.leadScore }}
Qualified {{ $json.qualifiedLead }}
Sentiment {{ $json.sentiment }}
Urgency {{ $json.urgency }}
Summary {{ $json.summary }}
Campaign {{ $json.campaign }}

This gives you a queryable call intelligence database without touching any backend code. Filter by score, pivot by intent, chart conversion rates by campaign — all in Google Sheets.


Get the Production-Ready Template

Building this from scratch takes a few hours of trial and error — prompt tuning, webhook debugging, IF node condition syntax, Sheets column mapping. I've already done that work.

I've packaged this as a production-ready n8n JSON template you can import and activate in 5 minutes. It includes the full workflow, the tuned AI prompt, Slack message template, and a Google Sheets schema you can copy.

Get it along with 15 other AI automation templates at [GUMROAD_LINK].

The bundle includes templates for lead enrichment, competitor monitoring, support ticket triage, contract summarization, and more — all built with the same n8n + DeepSeek cost-efficient stack.


I build AI automation systems, MCP servers for Claude/Cursor integration, and custom agent pipelines. If you're looking to automate a business workflow or need a production-grade AI integration built fast, find me on Upwork or reach out directly.

Tech stack I work with: n8n, Claude Code, MCP protocol, OpenAI/DeepSeek APIs, Node.js/TypeScript, Python.

📦 Get My Templates

Want these templates ready to use? Check out my complete collection of

25 production-ready n8n automation templates — ready to deploy immediately.

👉 Get the n8n Templates Bundle ($10)

Perfect for automation engineers, consultants, and anyone looking to accelerate their n8n projects with battle-tested workflows.

Top comments (0)