✦ The AI Brain

How the RecoverAI Agent Pipeline Works

Every debtor reply triggers a chain of specialised AI agents that translate, classify, and act — automatically.

📧
IMAP Parser Agent
Fetches unread invoice emails every 15 minutes via IMAP/SSL
→
🧠
Gemini Extraction Agent
Reads PDF invoices, extracts debtor name, amount, due date, GSTIN
→
🗄️
MongoDB Insertion Agent
Idempotent upsert — never duplicates. Logs every ingestion.
→
💬
NLP Reply Agent
Translates Hindi/Hinglish replies, classifies intent in real-time
→
⚡
Action Agent
Suggests follow-up, drafts WhatsApp reply, escalates to legal if needed
✦ Meet the Agents

6 Specialised AI Agents,
Working Together 24/7

RecoverAI is not one AI — it's an orchestrated fleet of specialised agents, each with a precise responsibility in the recovery pipeline.

Agent 01
📬
IMAP Parser Agent
Email Ingestion
Autonomously connects to your Gmail or any IMAP mailbox every 15 minutes via SSL. Scans all unread emails, extracts PDF invoice attachments, verifies the sender is a registered user (zero-trust), and passes raw PDF bytes downstream.

Tech: imaplib + asyncio.to_thread
IMAP/SSL Multi-tenant Async
Agent 02
📄
Gemini Extraction Agent
PDF Intelligence
Sends raw PDF bytes to Gemini 2.0 Flash as an inline blob (no temp files). Extracts 10 structured fields: debtor name, amount, due date, GSTIN, invoice number, PO number, email, phone, and notes. Prompt-injection hardened with strict rule set.

Output: Validated InvoiceCreate Pydantic model
Gemini 2.0 Flash JSON Schema XSS Safe
Agent 03
🗄️
MongoDB Insertion Agent
Idempotent Storage
Idempotent upsert engine — checks email_ingestion_log for the exact (message_id, filename) pair before every insert. Ensures zero duplicate invoices no matter how many times the ingester runs. Assigns invoices to the correct tenant account automatically.

Tech: Motor async + MongoDB compound index
Idempotent Motor Async Multi-tenant
Agent 04
🌐
NLP Translation Agent
Multilingual Understanding
Translates debtor WhatsApp replies from Hindi, Hinglish, Marathi, Tamil, Telugu, Gujarati, Bengali, Punjabi into clean professional English. If the Gemini API quota is hit, it falls back to a local keyword heuristic that covers 30+ Hindi/Hinglish payment terms (kal, bhej, deta, galat, etc.) — zero downtime.
8+ Languages Heuristic Fallback Zero Downtime
Agent 05
🎯
Intent Classification Agent
Reply Intelligence
Classifies the translated reply into one of four intents: promise_to_pay, dispute, stall, or unknown. Returns confidence level (high / medium / low) and a precise suggested action. Responds with a structured JSON object — validated against schema before use.
4 Intent Classes JSON Schema Confidence Score
Agent 06
🤖
AI Message Generation Agent
Recovery Drafting
Drafts WhatsApp messages, formal emails, and MSMED Act legal notices using a 3-tier Gemini model cascade: Gemini 2.0 Flash → Gemini 2.5 Flash → Gemini 1.5 Flash. Supports tone settings (firm / empathetic / legal). Generates full messages with context from invoice data including overdue days and MSMED compound interest.
3-Model Cascade WhatsApp + Email MSMED Legal
✦ Platform Features

Everything Built to
Recover Every Rupee

A complete, production-grade SaaS platform for Indian MSMEs. From invoice upload to legal notice — fully automated.

📊
Real-Time Dashboard
Outstanding vs. recovered bar charts, pipeline doughnut chart, recovery rate metric, and live overdue counters. Powered by Chart.js with 6-month trend views.
📁
Bulk CSV Import
Drag-and-drop upload of up to 500 invoices at once. Auto column mapping with smart validation. Zero data entry for existing accounting records.
⚖️
MSMED Act Legal Notices
Court-ready PDF notices with compound interest at 3× RBI Bank Rate (19.5% p.a.) calculated per Sections 15–17 of the MSMED Act 2006. Generated client-side via html2pdf.js.
📬
Debtor Inbox
Unified inbox for all debtor WhatsApp and email replies. Each message is AI-classified with intent badge, confidence score, and a suggested action — right inside the UI.
⏱️
Drip Campaign Automation
Preset reminder sequences: Day 7 gentle nudge → Day 21 firm follow-up → Day 35 final warning → Day 45 auto legal notice. Runs on autopilot, 24/7.
📈
PDF Performance Reports
Monthly recovery performance reports downloadable as PDF. Includes total dues, amount recovered, recovery rate, average days to recover, and top debtors list.
👥
Customer CRM
Full customer database with invoice history, payment behaviour score, contact info, GSTIN, and communication timeline. Filter by risk, city, or industry.
🔗
Tally ERP XML Export
One-click export of all invoices to Tally-compatible XML. Import directly into Tally ERP 9 or Prime with zero reformatting. Also supports CSV and JSON export.
🎨
White-Label Branding
Upload your own logo, set your brand name, tagline, and primary color. Changes apply instantly across the sidebar, legal notices, and all PDF exports.
🌙
Dark / Light Mode
Full dark mode powered by CSS variables. Smooth transition between modes. Preference is persisted to localStorage across sessions.
👑
Admin God Mode
Platform-wide admin dashboard. View total platform volume, all active users, system-wide recovery rates. Manage or suspend tenant accounts with full audit logs.
📱
Mobile Responsive
Fully responsive layout with a slide-in mobile drawer, sticky bottom tab navigation, and adaptive card layouts. Works on all screen sizes from 320px up.
✦ Enterprise Security

Production-Grade Security,
Out of the Box

RecoverAI was built with a full security audit — protecting your financial data with layers of hardened defences.

🔐
Brute Force Protection
IP-based rate limiter locks out after 5 failed login attempts in 15 minutes. Spoofing-resistant X-Forwarded-For parsing.
💉
NoSQL Injection Shield
Recursive payload sanitisation strips all MongoDB operators ($) from user inputs. Protected field blocklist prevents privilege escalation.
🛡️
SSRF Protection
URL parser blocks requests to private IP ranges (RFC 1918, RFC 3927), cloud metadata endpoints, and localhost — preventing server-side request forgery.
📁
Secure File Uploads
MIME type + extension allowlist. UUID-renamed files eliminate path traversal. 10MB chunk-based size limit against DoS.
🔑
JWT Token Revocation
In-memory JTI blacklist immediately invalidates access tokens on logout — preventing token reuse attacks even before expiry.
📋
Security Headers
HSTS, CSP, X-Frame-Options, X-XSS-Protection injected on every response. Server fingerprinting stripped from all HTTP headers.
📝
Audit Logging
Structured access log captures HTTP method, path, IP, latency, and status code for every request — full forensic trail.
🔒
HMAC Webhook Verification
WhatsApp webhook payloads are verified via X-Hub-Signature-256 HMAC before processing — rejecting forged Meta callbacks.
✦ Tech Stack

Built on a Modern,
Production-Ready Stack

Every technology choice was made to maximise performance, reliability, and developer velocity.

⚡
FastAPI + Python 3.11
Async-first ASGI backend. Full OpenAPI schema. Security middleware stack with raw ASGI to avoid ExceptionGroup crashes on Python 3.11+.
🍃
MongoDB Atlas + Motor
Fully async NoSQL database layer. $facet aggregation pipelines for high-performance dashboard analytics. TTL indexes for session cleanup.
🤖
Google Gemini 2.0/2.5 Flash
Primary AI engine for NLP, PDF extraction, and message generation. 3-tier model cascade ensures 99.9% uptime even during API saturation.
⚛️
React 18 (Zero-Build CDN)
Modular React frontend loaded via CDN + Babel standalone. No build step required — extremely portable. Runs anywhere, deploys in seconds.
☁️
Vercel Serverless
vercel.json routing matrix maps all API and frontend routes. FastAPI runs as serverless functions. Zero cold-start configuration needed.
🔐
JWT + Passlib + Jose
Industry-standard JWT authentication with bcrypt password hashing. Token revocation via JTI blacklist. Strong password policy enforced server-side.
✦ Get Started Today
Stop Chasing Invoices.
Let AI Do It For You.
Join 500+ MSMEs recovering dues 3× faster. Free to start — no credit card needed.
🚀 Start Recovering Free Sign In →
✓ No credit card ✓ MSMED Act compliant ✓ Cancel anytime ✓ Deployed on Vercel