Inspiration
Every day, millions of small and mid-sized businesses across Africa and emerging markets struggle to manage customer conversations at scale. WhatsApp is their primary channel — yet existing helpdesk tools are either prohibitively expensive, lack AI intelligence, or fail to handle the multi-regional latency that makes or breaks user experience in distributed markets.
We asked: What if we could build an AI-native customer support platform that is as intelligent as enterprise solutions, as fast as a local service, and accessible to any business with a WhatsApp number?
The answer is ImaradeskAI — a zero-infrastructure, AI-powered helpdesk that leverages AWS Aurora DSQL multi-region, vector embeddings, and a visual chatbot builder to deliver sub-100ms responses regardless of where your customers are.
What it does
ImaradeskAI is a full-stack, AI-native customer support platform built for the WhatsApp-first world. It combines:
🧠 Multi-Model AI Engine
- Three-provider architecture — seamlessly switches between Gemini 2.5 Flash, GPT-4o, and Claude Sonnet 4 based on task and availability
- Real-time intent classification into 9 categories (order_status, billing, refund, technical_support, product_question, complaint, greeting, farewell, other) with confidence scoring
- Sentiment analysis (-1 to +1 scoring) on every inbound message — feeds into escalation risk and customer health scoring
- Automatic language detection and translation — supports any language, responds in the customer's native tongue
- Conversation summarization — AI-generated ticket descriptions and summaries from multi-turn conversations
🤖 Visual No-Code Chatbot Builder (13 Node Types)
A drag-and-drop flow canvas with pan/zoom, auto-save, and flow templates:
| # | Node Type | Icon | Purpose |
|---|---|---|---|
| 1 | Trigger | Radio | Entry point — activates on keyword, regex, contact tag, business hours, first message |
| 2 | Send Message | MessageSquare | Sends a text message to the customer |
| 3 | Quick Replies / Buttons | ListOrdered | Presents numbered options for structured responses |
| 4 | AI Response | Sparkles | Single-turn AI generation using conversation context |
| 5 | Agent (Full AI) | BotMessageSquare | Multi-turn autonomous agent with memory, KB access, guardrails |
| 6 | Knowledge Base | BookOpen | Vector similarity search + AI-synthesized answer from uploaded docs |
| 7 | Smart Reply | MessageSquare | Template-based replies with shortcut matching |
| 8 | Condition | GitBranch | Multi-rule branching (equals, contains, starts_with, regex, not_equals) |
| 9 | Delay | Clock | Configurable wait (optimized for serverless at ≤5s) |
| 10 | Connector | GitMerge | Merge multiple branches into one path |
| 11 | Action | Zap | Side effects: create ticket, assign agent, add tag, close conversation |
| 12 | API Call | Globe | External HTTP calls with SSRF protection (blocks private IPs/localhost) |
| 13 | Human Handoff | UserCheck | Escalate to agent, auto-create ticket, assign best team |
Flow Execution Engine:
- Trigger priority matching (specific keywords before catch-all)
- Depth-limited execution (max 20 nodes) to prevent infinite loops
- Stateful conversations —
activeFlowId+currentNodeIdtracked per conversation - Full execution logging to
chatbot_logsfor debugging and analytics
📚 RAG-Powered Knowledge Base with Vector Embeddings
Upload → Extract → Embed → Store → Search → Generate
- Document ingestion: PDF (
unpdf), DOCX (mammoth), TXT, CSV - Embedding models:
gemini-embedding-001ortext-embedding-3-small(OpenAI) - Vector storage: Embeddings stored as JSON arrays in Aurora DSQL (no separate vector DB needed)
- Retrieval: Cosine similarity search ranks all KB entries against user query
- Generation: Top-k results passed as context to AI for grounded, hallucination-resistant answers
- File management: AWS S3 with UUID-based naming for security and deduplication
🌍 Multi-Region Database with AWS Aurora DSQL
// Geo-routing logic - selects nearest DSQL endpoint
function getNearestRegion(lat, lon) {
// Calculates Euclidean distance to us-east-1 and us-east-2
// Returns closest endpoint for minimum latency
}
- Regions configured:
us-east-1(N. Virginia) andus-east-2(Ohio) - Authentication: AWS DSQL Signer generates short-lived tokens, auto-refreshed every 10 minutes
- Connection pooling: Per-region pools with 5 max connections, 30s idle timeout
- Failover: If nearest region fails, falls back to secondary
- Geo-location routing: Client latitude/longitude determines which DSQL cluster handles the request
🎫 Intelligent Ticketing & SLA System
- Auto-ticket creation from AI conversation analysis (meaningful titles + descriptions generated by AI)
- SLA policies per priority level (first response, resolution, escalation timers)
- Escalation risk scoring (0-100) based on:
- SLA proximity (+40 pts if due within 30 min)
- Ticket priority (+25 for urgent)
- Customer frustration (4+ follow-ups = +15)
- Negative sentiment streak (+15)
- Staleness (8+ hrs no update = +10)
📊 AI-Powered Analytics Dashboard
- AI Copilot — suggests replies to agents with acceptance rate tracking
- Voice of Customer (VOC) — sentiment distribution, complaint detection, praise identification
- Agent Quality Score — weighted algorithm: resolution rate (40%) + sentiment impact (35%) + activity (25%)
- Contact Health Score (0-100) — based on engagement recency, open tickets, message frequency
- Topic trending — intent volume week-over-week with severity classification
- Workload distribution — agent capacity management with max concurrent chat limits
📢 Broadcast Campaigns
- Scheduled/immediate mass messaging via WhatsApp templates
- Audience segmentation with JSON-based filters (tags, segments, lists)
- Real-time delivery analytics: sent → delivered → read → replied → failed
- Template variable substitution:
{name},{phone}, custom fields
🔗 WhatsApp Cloud API Integration (Meta Graph API v21.0)
- Multi-channel support — one org can connect multiple WhatsApp Business numbers
- Message types: Text, templates, media (image, document, audio, video)
- Delivery tracking: Sent → Delivered → Read status webhooks
- Business profile management via API
- Webhook signature verification for security
How we built it
Architecture Stack
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16 (App Router) + React 19 | Server components, streaming, edge rendering |
| UI Framework | Tailwind CSS 4 + Radix UI + shadcn/ui | Accessible, responsive component library |
| Database | AWS Aurora DSQL (Multi-Region) | PostgreSQL-compatible, serverless, distributed |
| ORM | Drizzle ORM | Type-safe queries, schema migrations |
| File Storage | AWS S3 (Multi-Region) | Knowledge base docs, media attachments |
| AI Models | Gemini 2.5 Flash, GPT-4o, Claude Sonnet 4 | Multi-provider with fallback |
| Embeddings | gemini-embedding-001 / text-embedding-3-small |
Vector representations for semantic search |
| Auth | JWT (jose) + bcrypt | Stateless auth with refresh token rotation |
| Messaging | Meta WhatsApp Cloud API (Graph v21.0) | Two-way WhatsApp communication |
| Deployment | Vercel (Edge + Serverless) | Zero-config CI/CD, edge functions |
| Custom SMTP mailer | OTP verification, password reset | |
| Charts | Recharts | Analytics dashboards |
| Forms | React Hook Form + Zod | Type-safe validation |
Why AWS Aurora DSQL?
Traditional databases force you to choose between consistency and latency. Aurora DSQL gives us both:
- Multi-region active-active — writes replicate across
us-east-1andus-east-2 - PostgreSQL compatibility — zero migration cost from standard Postgres
- Serverless scaling — no capacity planning, scales to zero between requests
- IAM authentication — short-lived tokens via
@aws-sdk/dsql-signer, no stored passwords - Automatic failover — if one region goes down, traffic routes to survivor
Our implementation detects the user's geographic coordinates and routes database connections to the nearest DSQL endpoint, ensuring:
- < 10ms read latency for local users
- Automatic token rotation every 10 minutes
- Connection pool recycling on auth refresh
Why Vercel v0 + Edge?
- v0 accelerated our UI development — generated complex components (chatbot builder canvas, analytics charts, real-time conversation panels) in minutes
- Edge Runtime — middleware runs at the nearest Vercel POP, JWT verification happens in < 5ms
- Serverless Functions — auto-scaling API routes, no cold start management
- Vercel Analytics — built-in performance monitoring
AI Architecture Decisions
┌──────────────────────────────────────────────────────────────┐
│ INCOMING MESSAGE │
├──────────────────────────────────────────────────────────────┤
│ 1. Language Detection ──→ Auto-translate if needed │
│ 2. Flow Matching ──→ Execute chatbot nodes │
│ 3. Intent Classification ──→ Route to correct team │
│ 4. KB Vector Search ──→ Cosine similarity ranking │
│ 5. AI Response Gen ──→ Context-aware, multi-turn │
│ 6. Sentiment Analysis ──→ Escalation risk scoring │
│ 7. Auto-Escalation ──→ Ticket creation + team assign │
└──────────────────────────────────────────────────────────────┘
Performance optimizations:
- 5-minute TTL in-memory cache — prevents duplicate AI calls for identical messages
- Non-blocking tracking — AI call metrics logged asynchronously
- Lazy client initialization — AI provider SDKs only instantiated on first use
- Chunked embedding — documents truncated at 30K chars to stay within token limits
Challenges we ran into
Aurora DSQL token refresh in serverless — IAM tokens expire every 15 minutes, but serverless functions may cold-start after the token dies. We solved this with a 10-minute refresh interval and graceful reconnection logic.
Vector search without pgvector — DSQL doesn't support pgvector extensions. We implemented cosine similarity in application code by storing embeddings as JSON arrays and computing similarity in JavaScript. This actually gives us portability across any PostgreSQL-compatible DB.
Chatbot flow state management — Maintaining conversation state across multiple serverless invocations required careful DB-backed state tracking (
activeFlowId+currentNodeIdper conversation).Multi-model AI consistency — Each provider returns responses in slightly different formats. We built a unified abstraction layer that normalizes outputs and handles provider-specific quirks (Anthropic's content blocks vs OpenAI's message format).
SSRF protection in API Call nodes — Users can configure external HTTP calls in chatbot flows. We had to block private IP ranges, localhost, and metadata endpoints to prevent Server-Side Request Forgery.
WhatsApp webhook reliability — Meta occasionally sends duplicate webhooks or out-of-order status updates. We implemented idempotent processing using
waMessageIddeduplication.
Accomplishments that we're proud of
- 13-node visual chatbot builder with a real execution engine — not just a mockup, but flows that actually process messages end-to-end
- Multi-region database routing that automatically connects to the nearest AWS region based on user coordinates — true geo-aware infrastructure
- RAG pipeline without a dedicated vector database — proved that Aurora DSQL + application-level cosine similarity is viable for production knowledge base retrieval
- Three AI providers with transparent failover — the system degrades gracefully if any single provider is unavailable
- Full conversation lifecycle from first WhatsApp message → AI triage → chatbot flow → escalation → ticket creation → agent handoff — completely automated
- Sub-5-second end-to-end response time for AI-generated replies including embedding search, intent classification, and response generation
- Agent Quality Score algorithm that uses sentiment impact as a signal — rewarding agents who improve customer mood, not just close tickets fast
- Multi-tenant architecture — complete data isolation per organization with org-scoped indexes on every table
What we learned
- Aurora DSQL is production-ready for multi-region workloads — the PostgreSQL compatibility makes migration trivial, and IAM auth eliminates password management entirely
- You don't always need a vector database — for knowledge bases under ~10K documents, application-level cosine similarity with embedded JSON vectors performs well and reduces infrastructure complexity
- Vercel v0 is a legitimate productivity multiplier — complex UI components that would take days to hand-craft were generated and refined in hours
- Multi-model AI is the future — having three providers gives you negotiation leverage, fault tolerance, and the ability to route different tasks to the most cost-effective model
- WhatsApp is the world's most underserved platform for AI — billions of users, but tooling for businesses is still primitive compared to web/email helpdesks
- SLA scoring needs AI context — traditional time-based SLA systems miss nuance. Adding sentiment analysis and conversation depth makes escalation dramatically more accurate
What's next for ImaradeskAI
- More DSQL regions — expanding to
eu-west-1(Ireland),ap-southeast-1(Singapore) for true global coverage - pgvector on Aurora PostgreSQL — when DSQL adds extension support, we'll move to native vector indexes for O(log n) similarity search
- Voice message transcription — WhatsApp voice notes → speech-to-text → AI processing pipeline
- Agent AI Copilot v2 — real-time response suggestions with inline KB citations and confidence scoring
- Custom AI model fine-tuning — organization-specific models trained on their conversation history
- Multi-channel expansion — Instagram DMs, Facebook Messenger, Telegram, SMS via the same unified platform
- Advanced analytics — predictive churn scoring, CSAT prediction, automated A/B testing on chatbot flows
- Workflow marketplace — shareable chatbot flow templates between organizations
Built With
- aimodel
- amazon-web-services
- auroradsql
- awss3
- embeddings
- multiregion
- nextjs
- postgresql
- v0
Log in or sign up for Devpost to join the conversation.