/ Overview
Faigen is a multi-tenant AI automation SaaS that deploys intelligent WhatsApp and Instagram agents for businesses โ handling customer conversations, orders, appointments, and broadcast campaigns 24/7.
Built entirely from scratch as a solo founder and engineer โ from the multi-tenant backend architecture and AI integration all the way to the landing page, admin console, and WhatsApp webhook infrastructure.
Registered as an official Meta Tech Provider, giving access to the WhatsApp Business Cloud API for sending authentication templates, interactive button messages, and broadcast campaigns at scale. The AI speaks Malayalam, Manglish, and English โ auto-detecting the customer's language.
Visit faigen.in โ/ Capabilities
One platform. Every conversation channel. Every business type.
AI Conversation Engine
- โ Takes orders directly in WhatsApp chat
- โ Books appointments automatically
- โ Answers FAQs and product queries
- โ Malayalam, Manglish & English auto-detect
- โ Gemini AI with custom business context
- โ 15 message / 24hr limit with graceful handoff
Broadcast Campaigns
- โ Send to thousands of customers in one click
- โ WhatsApp Authentication OTP templates
- โ Marketing and Utility template support
- โ Delivery and read rate tracking
- โ Credit-based billing per message sent
- โ Festival offers, promotions, order updates
Business Dashboard
- โ Multi-tenant admin console per company
- โ Live conversation inbox with AI pause
- โ Order management and tracking
- โ Template creation and Meta sync
- โ Per-company AI config and feature flags
- โ Usage analytics and billing overview
/ Architecture
Multi-tenant from the ground up. Every company gets isolated AI config, feature flags, and billing โ sharing zero data across tenants.
โ ย ย ย ย ย ย ย โ ย ย ย ย ย ย ย โ
Webhook Router
Node.js / Express
Company Lookup ยท Queue ยท Dedup
AI Engine
Gemini / Groq
NLP ยท Order Parsing ยท Intent
Per-Company Data
MongoDB
Conversations ยท Orders ยท Config
Message Queue
In-Memory Queue
Per-phone serialization
Deduplication
processedMessageIds
Last 100 per conversation
Multi-tenancy
Company-isolated MongoDB
Every company has its own isolated AI context, system prompt, feature flags, conversation history, order records, and template library. A single MongoDB instance with companyId-scoped queries ensures zero data bleed between tenants. Each company gets independent AI provider config โ Gemini, Groq, or OpenAI.
Message Queue
Per-phone serialization
WhatsApp sends webhook events asynchronously with no guarantee of order. I built an in-memory queue keyed by phone number โ ensuring messages from the same customer are processed sequentially. This prevents AI from responding out of order or starting two conversations simultaneously for the same user.
AI Integration
Gemini + Groq fallback
The AI engine builds a structured conversation prompt from the company system prompt, aiContext (FAQs, rules, tone), and the last 50 messages. Gemini is the primary provider with Groq as automatic fallback. The AI response is parsed into typed actions โ text, order, menu, products, or buttons โ each handled differently by the webhook router.
WhatsApp Layer
Meta Cloud API
Full Meta WhatsApp Cloud API integration โ text messages, interactive button messages, list messages, authentication OTP templates, and broadcast campaigns. Template management syncs with Meta for approval status. Broadcast uses a credit-based billing system deducted per message at โน0.15 for auth, โน0.88 for marketing.
/ Hard Problems Solved
Building a production AI product means solving problems that don't have Stack Overflow answers.
Duplicate webhook prevention
WhatsApp fires the same webhook multiple times under load. I store the last 100 processed message IDs per conversation and reject duplicates before they hit the AI โ preventing double replies that would confuse customers and waste API credits.
24-hour conversation limit with graceful handoff
To control AI API costs, each conversation is limited to 15 customer messages per 24-hour window. When the limit is hit, instead of going silent, the AI sends a single warm convincing message with contact details โ converting the limit hit into a sales opportunity. The handoff message fires once every 24 hours, not on every message.
Malayalam NLP without a Malayalam model
Gemini and Groq don't have dedicated Malayalam models. The solution was prompt engineering โ the system prompt instructs the AI to auto-detect the customer's language and respond in the same language. Combined with Manglish (Malayalam written in English script) handling, this covers 95% of Kerala customer writing styles.
AI response type parsing
The AI needs to do more than reply with text โ it needs to trigger order creation, show product lists, send button menus, or hand off to a human. I built a structured JSON response parser that the AI returns tagged responses in, and the webhook router dispatches them to the correct WhatsApp message type.
/ What I Learned
Prompt engineering is real engineering
Getting an AI to behave consistently across thousands of conversations required as much careful design as the backend architecture. System prompt structure, instruction order, and output format constraints all materially change how the AI performs in production.
Multi-tenancy must be designed from day one
Adding multi-tenancy to a single-tenant system after the fact is painful. Every query, every model, every API route needs companyId scoping. Building this first means the codebase scales to hundreds of clients without architectural changes.
Product sense matters more than perfect code
The 24-hour limit handoff message turning a cost-control measure into a sales opportunity โ that's product thinking, not engineering. Building a SaaS alone forces you to think about user experience, business logic, and conversion at every technical decision.
Next Case Study
RTA Mailback Pipeline โ