Building an Event-Driven Multimodal Citizen Copilot: System Design of Akshaya Sahayi A computer science undergraduate is building Akshaya Sahayi, a WhatsApp-first civic copilot for Kerala's Akshaya citizen facilitation centers that uses Kapso automation workflows, a Node.js ingestion layer, Cloudinary media normalization, Supabase state storage and the Gemini API for multimodal document pre-verification and government scheme guidance. The system acknowledges webhooks with an immediate 200 OK before dispatching media and LLM work asynchronously, aiming to cut late-stage document rejections and portal navigation friction for applications such as income and caste certificates and welfare enrollments. Building an Event-Driven Multimodal Citizen Copilot: System Design of Akshaya Sahayi How I am designing and building a WhatsApp-first civic copilot using event-driven webhooks, decoupled media pipelines, and multimodal AI to reduce document rejections and simplify government portal navigation. Covers design patterns for idempotency, PII protection, and mapping civic workflows to AWS. Computer Science Undergraduate | Passionate about AI, machine learning, and full-stack development Public service portals and citizen facilitation centers such as Akshaya centers in Kerala process thousands of high-stakes applications daily—from income and caste certificates to welfare scheme enrollments. In practice, two bottlenecks slow down both citizens and operators: 1. Late-stage document rejections: Citizens often wait in queues only to discover a blurry scan, mismatched name spelling, or expired supporting certificate after manual review. 1. Portal navigation friction: Government service portals involve multi-step forms, shifting eligibility rules, and dense regional-language terminology that confuse first-time applicants. To solve both problems at the edge, I am currently building Akshaya Sahayi —an automated WhatsApp citizen intake, multimodal document pre-verification, government scheme guidance, and live portal navigation copilot. Here is how I am architecting the system and how its patterns map to scalable cloud-native workloads. 1. Why WhatsApp + Event-Driven Webhooks? For civic and public-interest software, forcing users to download a standalone app or create another portal login creates unnecessary friction. By anchoring the user interface in WhatsApp via Kapso automation workflows, citizens can interact with the system using voice notes, text queries, and phone-camera photos of their documents. Because webhook payloads from messaging platforms arrive asynchronously and carry strict timeout windows typically a few seconds before retries trigger , synchronous processing inside the request handler breaks down quickly under load. In my architecture, I separated message ingestion from multimodal inference : ┌───────────────────┐ Webhook ┌──────────────────────────┐│ Citizen Client │ ─────────────────► │ Kapso + Node.js API ││ WhatsApp / Media │ │ Fast Ack & Validation │└───────────────────┘ └────────────┬─────────────┘ │ ┌──────────────────────────────┼──────────────────────────────┐ ▼ ▼ ▼ ┌─────────────────────────────┐ ┌──────────────────────────┐ ┌─────────────────────────────┐ │ Media Pipeline │ │ State & Audit DB │ │ AI Reasoning Engine │ │ • Cloudinary Ingestion │ │ • Supabase PostgreSQL │ │ • Gemini API Multimodal │ │ • Normalization & CDN URLs │ │ • Session & Step State │ │ • Scheme RAG & Portal Nav │ └─────────────────────────────┘ └──────────────────────────┘ └─────────────────────────────┘ - Fast Webhook Acknowledgment: My Node.js ingestion layer validates the incoming Kapso webhook signature, persists the raw event state, and returns an immediate 200 OK before kicking off heavy media or LLM tasks. - Decoupled Media Handling: Incoming document photos and PDFs are streamed to Cloudinary for format normalization and secure URL generation rather than passing raw binary blobs across application services. 2. Three Core Functional Pipelines I Am Implementing A. Multimodal Document Pre-Verification Before a citizen visits a facilitation center or submits an online application, Akshaya Sahayi runs an automated pre-check on uploaded IDs and supporting certificates: - Visual & Structural Check: Using Gemini API multimodal capabilities, the pipeline inspects image clarity, checks whether required stamps or signatures are cropped out, and extracts key fields name, document ID, issue date . - Cross-Document Consistency: Extracted fields are compared against the citizen's session state in Supabase to flag spelling discrepancies or missing prerequisites early, helping prevent avoidable counter rejections. B. Government Scheme Eligibility & Guidance Citizens rarely know the exact official name of a welfare scheme—they describe their situation such as student scholarships, housing assistance, or pension renewals . - My copilot maps natural-language queries against structured scheme criteria, returning clear eligibility checklists, required document lists, and fee or timeline expectations in plain language. C. Live Portal Navigation Copilot Beyond Akshaya center pre-intake, many services can be completed directly by citizens on state and central e-governance portals if they have step-by-step guidance: - Akshaya Sahayi tracks where the user is in a multi-page portal workflow, explains what each form field expects, and troubleshoots common validation errors in real time. 3. Cloud Architecture & Security Considerations As I prepare this project for wider deployment—and look at how it translates to production AWS infrastructure using API Gateway , AWS Lambda , Amazon S3 , Amazon RDS / DynamoDB , and Amazon Bedrock —three design rules are central to my build: 1. Idempotent Webhook Consumers: Messaging gateways retry webhooks whenever network jitter delays an acknowledgment. Tracking a unique message id constraint in PostgreSQL/Supabase prevents duplicate AI invocations and double replies to the citizen. 1. Zero-Retention / Scoped Media Policies: Citizen identity documents contain sensitive Personally Identifiable Information PII . Media assets stored in object storage Cloudinary or S3 need signed, short-lived URLs and automated lifecycle expiration rules once verification completes. 1. Structured JSON Outputs Over Free-Form Text: For document verification and portal step routing, enforcing strict JSON schemas from the model keeps backend state transitions predictable rather than relying on fragile regex parsing. 4. Key Takeaways From Building This System - Meet users where they already are: Pairing conversational interfaces WhatsApp with multimodal LLMs lowers UI barriers for non-technical citizens far more effectively than building a complex web form. - Separate media storage from inference: Offloading image optimization and hosting to a dedicated media layer keeps stateless API workers fast and lightweight. - Design for graceful fallback: When an image is too blurry for confident extraction, the workflow explicitly prompts the user to retake the photo in better lighting rather than guessing fields. How do you handle idempotency and PII cleanup when processing user-uploaded documents in webhook-driven AI pipelines? Share your approach in the comments below. Enjoyed reading this content? Let the author know Your likes, comments, shares, and saves help creators reach more builders. Loading recommendations