All work

AI · Full-Stack · Case study

KisanVoice AI

WhatsApp survey platform that lets farmers answer by voice in their own language. A config-driven language registry covers 24 locales (10 Indian) over Google STT/TTS, with WhatsApp Flows for long option sets, phone-call surveys through the voice-agent platform, and a real-time admin dashboard.

Role
Lead author, CortexCraft.ai
Team
3 contributors
Timeline
March to August 2026
Commits
172 of 192
Stack
Python · FastAPI · React · MongoDB · WhatsApp Flows · Google STT/TTS · Plivo · Socket.io · Jenkins · Docker

Responsibilities

  • FastAPI backend that replaced the Node.js one
  • Google speech-to-text and text-to-speech services
  • Config-driven language registry (24 locales)
How it worksA voice answer on WhatsApp, end to end
  1. 01

    WhatsApp webhook

    routes/whatsapp_routes.py

  2. 02

    Session controller

    controllers/whatsapp/whatsapp_controller.py

  3. 03

    Speech to text

    services/google_stt_service.py

  4. 04

    Answer matching

    services/gemini_llm_service.py

  5. 05

    Next question

    services/survey_engine.py

  6. 06

    Text to speech

    services/tts_service.py

  7. 07

    Reply on WhatsApp

    services/whatsapp_api_service.py

DataMongoDB

Situation

Field surveys of rural farmers are slow, expensive and exclude people who can not read or fill in forms. Enumerators travel village to village, and language barriers across regions make consistent data collection hard.

Task

Build a platform that lets farmers answer surveys in their own language by voice over a channel they already use, WhatsApp, while giving administrators a real-time view of incoming responses and a way to verify audio quality.

Action

I built the system on the WhatsApp Business API: inbound voice notes are transcribed, auto-translated, and run through conditional survey logic that picks the next question, with the reply synthesised back in the farmer’s language. Long option sets go out as WhatsApp Flows with pagination rather than unusable text menus, and option matching survives imperfect speech through fuzzy and semantic fallback matching. A React dashboard with an audio QC workflow and Excel export receives live call events over Socket.io. Two migrations did the most for the platform: I replaced the Node backend with FastAPI so Python is the single backend, and moved STT/TTS from Sarvam to Google Cloud behind a config-driven language registry — adding a locale is now a config row, not a deploy. Phone surveys route through the CortexCraft voice-agent platform, and Jenkins drives the build.

backend-python/app/services/language_registry_service.pypython
# JSON defaults + MongoDB admin overrides, merged into one alias index.
# Adding a language is a config row, not a deploy.
for raw in config.get("languages") or []:
    code = str(raw.get("code") or "").strip().lower()
    if not code:
        continue
    merged = _apply_env_tts_overrides(raw)
    if code in override_by_code:
        merged = _deep_merge(merged, override_by_code[code])
        merged["code"] = code

    canonical = str(merged.get("canonicalName") or code).strip().lower()
    profiles_by_iso[code] = merged
    profiles_by_canonical[canonical] = merged

    for alias in (code, canonical, str(merged.get("locale") or "").lower()):
        if alias:
            alias_to_iso[alias] = code

Result

A deployed multilingual survey platform that removes the literacy barrier. Farmers answer by voice in their own language and administrators verify responses as they arrive. 172 of the repository’s 192 commits are mine, across a backend migration and an STT/TTS provider swap done without losing the running surveys.

24

locales configured

172

commits authored

Node → FastAPI

backend migrated

Looking back

What I would do differently

  • Delete the leftover Sarvam guard module, which nothing imports any more.
  • Consolidate the duplicated WhatsApp route and controller modules into one of each.
  • Stream WhatsApp survey answers to the dashboard live; today only phone-call events are pushed.