InvoNotify
AI-powered invoice revenue recovery — detects overdue invoices, scores collection risk, and pursues payments across email and WhatsApp.

InvoNotify
InvoNotify is an AI-powered invoice revenue recovery platform. Instead of sending the same late-payment email to everyone, it detects overdue invoices, assigns each one a collection-risk score, and runs the recovery through a policy engine before acting — with Razorpay payment links and webhook settlement completing the loop.
The system was designed end-to-end first (see proposed.md), then built out as a working platform: invoicing, customers, dashboard, and the AI recovery engine.
The Problem
Collections fail quietly:
- Late payments go unnoticed — nothing flags the invoice that just crossed its due date.
- Follow-up is risk-blind — a steady customer one week late gets treated the same as a repeat offender months overdue.
- There's no payment path — reminders without a way to pay inline turn a nudge into a chore.
How recovery works
Invoice created → due date passes → AI detects overdue → ML risk score
→ Policy engine (9 guardrails) → Email / WhatsApp → Razorpay link
→ Customer pays → Webhook → invoice settled, case closed
- Detect — the AI engine sweeps for invoices past due.
- Score — a logistic-regression model predicts collection risk on a 0–1 scale from eleven features: balance, days overdue, payment history, success rate, prior reminders, CIBIL score, VIP flag, and whether a human is already engaged.
- Decide — an LLM decision agent proposes an action; the policy engine approves or blocks it.
- Act — recovery runs through the channel the decision allows: a gentle email, a Razorpay payment link, or a WhatsApp reminder via the Meta Cloud API.
- Settle — a Razorpay webhook records the payment, marks the invoice paid, and closes the recovery case.
ML risk scoring
| Score | Level | Action |
|---|---|---|
| ≥ 0.85 | CRITICAL | Escalate to a human immediately |
| ≥ 0.70 | HIGH | Aggressive follow-up |
| ≥ 0.40 | MEDIUM | Payment link + reminders |
| < 0.40 | LOW | Gentle nudge |
The model is custom logistic regression trained on invoice and customer history — no closed platform, no black box. Every score is explainable back to its feature weights.
Policy engine guardrails
No recovery action fires unchecked. Every decision is gated by nine rules: skip already-paid invoices, respect opt-outs, hold disputes, route VIPs to humans, drop balances too small to recover, require approval above a money limit, enforce contact cooldowns, cap daily escalations, and only contact within business hours.
If an action is blocked, the case still gets a decision record — the audit trail keeps the full history for every invoice.
Architecture
Dashboard (Next.js) → AI Engine (ML + LLM) → Providers (Razorpay)
│ │ │
▼ ▼ ▼
PostgreSQL Policy Engine Channels
(Neon + Prisma) (9 guardrails) (Email / WhatsApp)
- Next.js 16, React 19, Tailwind on the frontend; Next.js API Routes for the backend.
- PostgreSQL (Neon) with Prisma ORM — users, invoices, recovery cases, agent actions, promises-to-pay, and payment events are first-class models with real migrations.
- Razorpay payment links do the collecting; the webhook endpoint verifies signatures before recording payment.
- Email via Gmail SMTP (nodemailer), WhatsApp via the Meta Cloud API — the two recovery channels.
- NextAuth v5 for session auth, with user-scoped database queries.
- CI/CD — GitHub Actions workflows run CI, a scheduled AI recovery sweep, and automated reminders.
Security
Session-based auth, user-scoped queries everywhere, CRON_SECRET protected endpoints, Razorpay webhook signature verification, and a policy engine that blocks unauthorized actions — with an audit trail for every decision.
Roadmap
- WhatsApp channel rollout and configuration polish.
- Recovery analytics and ML failure diagnosis in the dashboard.
- Multi-merchant support and production hardening.
Status
Active. A working invoice, recovery, and payment platform — designed before it was built, and shipped to production.