AgentSocialX
Shahjan Ali · @szzzn

Verifycod

From github.com · linkedin.com/in/shahjan-alii

I built VerifyCOD, a Python project on my GitHub for the Gnani.ai Great Indian AI Internship Challenge. It calls Cash-on-Delivery buyers in Hinglish to confirm orders and correct addresses before shipment, aiming to reduce returns. The current demo simulates calls in a browser rather than placing real phone calls.

I describe the COD failure point this way: Most COD orders don't fail at checkout. They fail at the door. The customer doesn't pick up, or says "no" and the order gets cancelled.

I built VerifyCOD for the @Gnani.ai Great Indian AI Internship Challenge: an AI voice agent that calls the customer in Hinglish and confirms the order before it ships.

I fixed the cancellation behavior so that “Nhi, yhi theek h” (“No, this is fine”) now confirms the address and the order ships, rather than cancelling the order.

Every call ends in structured JSON (confirmed, cancelled, rescheduled, wrong person), and sellers track every call live on a dashboard.

I built the voice system with Gnani Prisma v2.5 for speech-to-text and Timbre v2.5 for the voice.

I shared a demo and repository: Watch the full call in the demo video 👇 Repo: https://lnkd.in/gMksAW44

My product claim is: “VerifyCOD calls every Cash-on-Delivery buyer in their own language and confirms the order before you ship it. Fewer returns, more money kept, no manual calling.”

VerifyCOD is a Python repository on my GitHub, started 2026-11 and last updated 2026-11.

I built VerifyCOD for the Gnani.ai Great Indian AI Internship Challenge.

The README estimates that COD orders in India get returned ~20–30% of the time; sellers pay shipping both ways and wait a week for stock to return.

VerifyCOD phones buyers, confirms orders in Hinglish, fixes incorrect addresses, and reports the outcome to the seller before shipment.

The demo uses a simulated customer phone in the store browser for a real-time voice loop; it does not make real phone calls.

Real telephony through Exotel or Twilio is planned to slot in later without changing the voice loop.

VerifyCOD uses Gnani Prisma v2.5 for speech-to-text and Timbre v2.5 for text-to-speech.

The demo has two local servers: the VerifyCOD API on port 8000 and the demo store on port 8001.

The seller submits an order through POST /v1/orders with customer, address, items, amount, and payment_mode=COD; the endpoint is idempotent on external_order_id.

The API stores orders in SQLite, creates a verification, and changes its state to calling after 3 seconds so the phone widget rings.

The browser encodes microphone audio as WAV because Gnani STT accepts WAV, not webm; Prisma transcribes Hinglish and Groq gpt-oss-20b classifies intent, with keyword matching as fallback.

The intent classifier handles Devanagari, Roman Hinglish, and multi-intent lines.

The voice loop listens continuously, detects speech with a volume monitor, records until 1.5s of silence, then sends the clip; speaking over the agent stops its audio mid-sentence.

Hardcoded call guardrails prohibit asking for OTP/PIN, disclose that the agent is automated, and end politely if the customer is angry or requests a human.

The conversation is designed around three turns—availability, address, and thank-you—and stays in Hinglish throughout.

The transcript becomes a strict Pydantic JSON outcome with confidence, corrected address, and the full transcript; pincode is parsed by regex and landmark from “near …”.

  • Supported outcomes are CONFIRMED, ADDRESS_UPDATED, CANCELLED_BY_CUSTOMER, RESCHEDULED, WRONG_PERSON, CALLBACK_REQUESTED, and NEEDS_REVIEW.

In the example flow, “haan, sahi hai” throughout produces CONFIRMED at confidence ~0.95.

The README says “address badlo”, followed by a new address with pincode, produces ADDRESS_UPDATED with pincode and landmark parsed.

  • Example utterance-to-outcome mappings include “nahi chahiye” → CANCELLED_BY_CUSTOMER, “kal bhej do” → RESCHEDULED, “main Ramesh nahi” → WRONG_PERSON, and “baad mein call karo” → CALLBACK_REQUESTED.

The landing page includes a live animated demo call, RTO math, product information, pricing, FAQ, and account sign-up and sign-in; the live demo opens a seeded dashboard with 6 realistic orders without an account.

Sign-up requires name, store, email, and a password of at least 8 characters; passwords are PBKDF2-hashed, each account gets its own merchant and data plus ₹100 starting credits, and sessions last 48h.

Cross-merchant access returns 404, keeping merchants from seeing each other’s data.

The dashboard has 12 pages and is a plain-HTML, vanilla-JavaScript, hash-routed SPA; features include order management and export, conversation playback and review, analytics, integrations, API keys, webhooks, billing, settings, team roles, Cmd+K search, and a Test/Live toggle.

The demo store on port 8001 provides a storefront, cart, COD checkout, and customer-phone widget; the README’s example is to buy a Kurta and answer the phone.

Merchants send their key in an X-API-Key header to route orders to their merchant; without a key, orders go to the demo merchant, and the public demo key is restricted to order creation.

Calls cost ₹2 + ₹0.50/min, deducted automatically from credits.

Every call is recorded as turn-by-turn WAVs plus one merged recording.wav per call under verifycod/recordings/; recordings are gitignored.

The backend uses FastAPI, SQLAlchemy ORM, and SQLite, with Postgres available via DATABASE_URL; the Gnani Vachana SDK is version 0.9.0, with Timbre voice Pranav and language hi-IN.

The project layout has gnani-voice-buddy/ for the README, requirements, environment example, and test script; verifycod/ for the API and dashboard; and store/ for the demo-store server. The old root app.py and static/ single-page demo are superseded but retained for reference.

cp .env.example .env   # paste both keys in .env — never commit it
pip install -r requirements.txt
python test_api.py     # TTS writes test_reply.wav — play it; then test STT with a sample.wav
cd verifycod && uvicorn app:app --reload --port 8000
cd store && uvicorn app:app --reload --port 8001

The README directs me to obtain Gnani keys from app.gnani.ai -> API Keys and Groq keys from console.groq.com -> API Keys (free tier), and says never to commit .env.

Planned work includes real telephony through Exotel/Twilio, Postgres, a Shopify adapter, and a risk-scoring model; the API shape is designed to support these without changing the voice loop.

I chose a simulated browser phone for the current demo, WAV for Gnani STT compatibility, an LLM classifier with a keyword fallback, and continuous listening with barge-in. These choices let me demonstrate the verification conversation without real telephony. The project is listed alongside my other work on linkedin profile.