Project Overview
AI-Powered Customer Health Risk Detection
A customer-success automation system built with n8n, Google Sheets, Gemini agents, Slack and a Next.js web interface.
- Risk signals
- 4
- AI agents
- 4
- n8n flow
- 1
The Problem
Churn risk is usually spotted too late
Customer success teams often identify churn risk too late because customer-health information is spread across operational systems.
This project centralizes those signals and turns them into actionable risk analysis.
Solution
Detect, reason, recommend, automate
Detect
Evaluate customer activity, NPS, support status and renewal proximity.
Reason
Use specialized AI agents to classify risk and interpret signals.
Recommend
Generate an appropriate next action for the account manager.
Automate
Support downstream workflows such as task creation and Slack alerts.
Architecture
How a request flows through the system
The browser never talks to n8n directly: a server-side API route proxies every analysis request.
Web application
BrowserNext.js Web App
Customer is selected in the analyzer
Next.js/api/analyze
Server-side proxy route
n8n workflow
Triggern8n Webhook
Receives the customer ID
DataGoogle Sheets
Loads the customer record
RulesDeterministic Risk Calculation
Business rules compute health metrics
Risk Classifier Agent
Risk Signal Extractor Agent
MergeMerge Agent Analysis
Combines both agent outputs
GeminiAction Reasoner Agent
Decides the follow-up
ResponseAPI Response
Structured JSON result
- Result
Web App
Risk level, signals and recommended action are displayed
AI Agent Architecture
Specialized agents on top of deterministic rules
Each agent has a single, narrow responsibility. Their outputs are merged into one structured analysis.
Deterministic calculations remain part of the system. Customer-health metrics are computed by explicit business rules in n8n before any agent runs. The agents receive those results as input to classify, explain and decide, rather than recomputing them.
Risk Classifier Agent
Determines risk level, category and confidence.
- riskLevel
- riskCategory
- confidence
Risk Signal Extractor Agent
Identifies factual risk indicators from customer data.
- riskSignals
Action Reasoner Agent
Decides whether action is needed and recommends the follow-up.
- priority
- recommendedAction
Slack Composer Agent
Being reintegratedFormats approved decisions into clear Slack messages.
- Slack message
Tech Stack
Built with production-grade tools
n8n
Workflow orchestration
Next.js
Web app and API proxy
TypeScript
Typed application code
Tailwind CSS
Interface styling
Google Sheets
Customer data source
Google Gemini
LLM behind the agents
Slack
Team alerts
Docker
Local n8n runtime
Vercel
Web app hosting
Risk Signals
Four indicators from the customer sheet
Each signal maps to a column of the Google Sheets customer data.
Inactivity
Time elapsed since the customer last logged in.
last_login_date
NPS
The latest Net Promoter Score reported by the customer.
nps
Support Escalation
Whether the account currently has an escalated support case.
support_escalated
Renewal Window
How close the contract is to its renewal date.
renewal_date
Current Prototype Status
What works today, and what comes next
Completed6
- Customer data retrieval
- Deterministic risk detection
- Multi-agent risk reasoning
- Responsive web interface
- API proxy
- Vercel deployment
In Progress3
- Production n8n public endpoint
- Final task / Slack reintegration
- Production hardening
Try the Customer Health Analyzer
Run a live analysis on one of the sample customers.