Sudarshan Pipes AI Assistant
Problem
Sudarshan Pipes (SEPL) needed one place to run WhatsApp outreach and customer replies, read tender BOQs, prepare GST quotations and onboard vendors and technicians, instead of spreading that work across phones, spreadsheets and paper forms.
What I built
Built for Sudarshan Pipes (SEPL), a PVC and HDPE pipe manufacturer in Bengaluru. It began as a WhatsApp bulk-messaging tool with an AI chatbot and grew into an internal operations suite: campaigns, an AI-powered inbox, reading tender BOQs, generating quotations, vendor KYC, and staff and technician registration.
Tech stack
- React 19
- Vite
- Tailwind CSS
- Node.js
- Express
- Socket.IO
- Supabase (Postgres · Storage)
- Baileys
- WhatsApp Cloud API
- NVIDIA (OpenAI-compatible)
- Resend
- Vercel
- Render
Results
- One platform covering campaigns, the AI inbox, BOQ-to-quotation, vendor KYC and staff registration
- About 60 smoke-test scripts plus a dedicated campaign-reliability suite
- Automatic safety stops and business-hours sending protect the company's WhatsApp account
Campaign
SendingDealer update · {{name}}
- Sent
- 214
- Delivered
- 201
- Read
- 151
contacts.xlsx · 350 recipients
Business hours in recipient's time zone
Random pacing · daily cap · auto-pause
BOQ → Quotation
- HDPE pipe 90 mm PE100120 mPipe
- PVC pipe 110 mm IS 498540 nosPipe
- Trench excavation85 m³Not pipe
45398 80 → 45,398.80OCR fix logged
WhatsApp · AI inbox
Illustrative interface, not a screenshot
Sudarshan Pipes AI Assistant, in detail
Architecture
- React 19 + Vite frontend on Vercel talks to a Node/Express backend over HTTPS and Socket.IO for live updates.
- Supabase Postgres and Storage hold all data and files. The browser never reads tables directly; the backend scopes every query to one user.
- AI runs on any OpenAI-compatible endpoint, NVIDIA by default (Llama, DeepSeek, Nemotron OCR, vision models), with a separate key and model per feature.
- The server refuses to start without an encryption key, and warns at startup if a required SQL migration hasn't been run.
- Public forms (KYC, technician, employee registration) need no login; the WhatsApp webhook is public but verifies its HMAC signature.
AI inbox and auto-reply
- Opt-out check that understands Hinglish: “STOP”, “unsubscribe”, “bandh karo”, “mat bhejo”. “START” opts back in.
- Human handoff: “talk to a human”, “call me” or “manager” flags the conversation and sends a holding reply.
- AI replies grounded in a Knowledge Base built from uploaded TXT, MD, PDF or DOCX files, split into chunks for lookup.
- New messages and unread counts are pushed to the dashboard as they arrive.
Campaigns
- Four-step builder: Audience → Message → Safety → Review, with {{name}} / {{company}} fields filled per contact from Excel.
- Recipients are claimed atomically, so nobody gets the same message twice.
- Randomised delays (0.7×–1.4×), hourly and daily caps, and optional pauses every N messages.
- Messages go out only during business hours in both your country and the recipient's, using the phone's country code.
- Each WhatsApp error maps to an action: pause, retry with exponential backoff, fail permanently, or record an opt-out.
- Automatic stops: pause if 50% of the last 20 sends failed, or after 5 identical errors in a row.
- Sent → delivered → read tracking, scheduled sends, duplicate, retry failed and media attachments.
BOQ extraction and quotations
- Upload a tender BOQ as PDF or Excel; scanned PDFs go through OCR, then an LLM extracts structured rows in chunks within a time budget.
- Row repair checks qty × rate = amount, compares against the rate in words, and fixes OCR decimal errors (“45398 80” → 45398.80). Every change is logged and flagged rows must be reviewed.
- Rule-based detection sorts each line into plastic pipe (HDPE, PVC, IS 4984…), other pipe, or not a pipe.
- Quotations with your own rates, server-side GST (CGST + SGST or IGST), amount in words, and sequential numbers like SP/2026-27/0001.
- Export as Excel with live formulas, a customer PDF, or send the PDF straight over WhatsApp.
AI tools for staff
- Ask AI: an employee assistant answering from built-in knowledge, so a broken Knowledge Base can't break it.
- Copilot: summarises a contact or conversation for a sales rep, with open questions, products discussed and talking points.
- Image Extractor: reads business cards or lead lists with OCR / vision models into exportable lead rows.
- Product Identification: identifies a pipe from a photo of it and its printed markings.
Forms, HR and admin
- Vendor KYC form with document uploads, staff review and export.
- Multi-language technician registration, plus employee self-registration and a staff directory with target progress and summary stats.
- Storage monitor that emails alerts at 70 / 85 / 95 / 100% capacity, with a download-ZIP-then-clean-up tool.
- Analytics: messages per day, campaign sent / delivered / read / failed, replies and opt-outs. Email via Resend.
- Shared workspaces let one account open another's data after a share-list check; settings and WhatsApp stay owner-only.
Data, security and testing
- API keys, WhatsApp tokens and sessions encrypted at rest with AES-256-GCM.
- Schema built from 21 ordered Supabase migrations.
- Security smoke tests for AI-key leaks, encryption at rest, JWT claims, internal-knowledge isolation and shared-access rules.
- About 60 smoke-test scripts run against a fake Supabase client, plus a dedicated campaign-reliability suite.