0tokens

Apply for AI Grants India

Financial support for innovators building the future of AI in India.

Apply now

Chat · how to build whatsapp chatbot with small language model in telugu

How to Build a Telugu WhatsApp Chatbot with a Small Language Model

  1. aigi

    WhatsApp is one of the most practical channels for reaching customers, field teams, students, and citizens in India. A Telugu chatbot can answer frequently asked questions, collect leads, check order status, share reminders, or route complex cases to a human agent. For many of these tasks, a small language model (SLM) combined with retrieval and strict business rules is cheaper, faster, and easier to control than a large generative model.

    The right design is not “connect an LLM to WhatsApp and hope for the best.” It is a narrow, measurable service with Telugu-first content, a reliable webhook, clear escalation paths, and protection for user data.

    Define the job before choosing the model

    Start with one workflow and a small set of supported intents. Good first use cases include:

    • Product, pricing, hours, and location FAQs
    • Lead capture and appointment requests
    • Order or application status checks
    • Telugu-language onboarding and reminders
    • Internal help desks for sales or field staff

    Write down what the bot will not do. For example, it may explain a loan application process but must not approve a loan, provide medical diagnosis, or invent a government benefit. A focused scope improves accuracy and keeps the SLM small.

    If your use case needs long, open-ended answers, compare the experience with a voice agent versus a chatbot. WhatsApp text works well when users need records, links, forms, or asynchronous updates.

    Recommended architecture

    A production setup can be split into six components:

    1. WhatsApp Cloud API receives and sends messages.
    2. Webhook service verifies Meta’s callback and parses events.
    3. Conversation service identifies the user, session, language, and intent.
    4. Knowledge layer retrieves approved Telugu answers from a database or document index.
    5. Small language model classifies intent, extracts entities, or drafts a response within limits.
    6. Operations layer stores logs, metrics, opt-outs, and human handoffs.

    Use the model where it adds value. Deterministic code should handle authentication, payment links, booking slots, status lookups, and policy checks. The model can classify variations such as “నా ఆర్డర్ ఎక్కడ ఉంది?” and extract an order number, but the order status should come from your system of record.

    For Telugu and other Indic languages, review the principles in this low-resource Indic NLP builder’s guide. Telugu users may write in Telugu script, Romanised Telugu, English, or a mixture of all three, so language detection and normalisation deserve explicit testing.

    Choose and prepare the small language model

    A practical first version often uses a multilingual encoder or compact instruction model through an inference API or a self-hosted runtime. Select based on measured performance, not parameter count alone. Check:

    • Telugu comprehension across script, spelling variation, and code-mixing
    • Latency and memory use on your expected hardware
    • Licence and commercial-use terms
    • Structured-output support for intent and entity extraction
    • Availability of quantised versions for lower-cost inference

    Do not begin by fine-tuning a model on a large, messy chat export. Create an intent schema first. For each intent, collect real or carefully authored examples in Telugu, Romanised Telugu, and mixed Telugu-English. Include polite, abbreviated, misspelled, and ambiguous messages.

    A useful classifier output might look like this:

    {
      "intent": "order_status",
      "entities": {"order_id": "A12345"},
      "confidence": 0.94,
      "language": "te"
    }

    Set confidence thresholds. High-confidence requests can proceed automatically; uncertain messages should trigger a clarification question or human handoff. Keep a versioned evaluation set that the model never sees during training.

    Build the WhatsApp integration

    Create a Meta Business account, configure a WhatsApp Business number, and use the WhatsApp Cloud API where it fits your operating model. Your webhook must support:

    • GET verification requests from Meta
    • POST message and status events
    • Signature or token validation
    • Fast acknowledgement, ideally before slow model inference
    • Idempotency, so retries do not send duplicate replies

    A minimal Flask outline is useful for orientation, but production code must validate the complete payload rather than assuming messages[0] exists:

    from flask import Flask, request
    
    app = Flask(__name__)
    
    @app.post("/webhook")
    def receive_event():
        payload = request.get_json(silent=True) or {}
        # Verify authenticity, record event_id, and enqueue processing.
        return "OK", 200

    Process the event asynchronously with a queue. The worker can fetch the conversation state, run intent classification, call business systems, and send a response through Meta’s Graph API. Store access tokens in a secret manager, not in source code or environment files committed to Git.

    Remember WhatsApp constraints: template messages are required for certain business-initiated conversations outside the customer-service window, and templates need approval. Design short, readable responses with clear buttons or numbered options where supported. Never ask users to send Aadhaar numbers, passwords, full card details, or unnecessary personal information in chat.

    Make Telugu the default experience

    Translation alone is not localisation. Work with Telugu-speaking reviewers to define terminology, tone, and fallback wording. Decide whether the bot should use formal Telugu, conversational Telugu, or a controlled mix with English product names.

    Useful practices include:

    • Preserve names, order IDs, dates, and amounts exactly.
    • Format Indian currency and dates consistently.
    • Accept common Romanised Telugu variants where feasible.
    • Confirm uncertain speech-to-text or transliteration results.
    • Offer a language switch such as “తెలుగు / English”.
    • Keep one idea per message and avoid dense paragraphs.

    Maintain a glossary for domain terms. In agriculture, finance, healthcare, and public services, a seemingly small translation error can change the meaning. Every high-impact answer should come from an approved source or be reviewed before launch.

    Add retrieval, rules, and human handoff

    For FAQs, use retrieval-augmented generation or a simple intent-to-answer mapping rather than asking the SLM to memorise company facts. Store Telugu documents with metadata such as product, region, effective date, and approval status. Return citations or a source label internally so support teams can audit answers.

    Build explicit fallbacks:

    • Ask one clarifying question when the request is incomplete.
    • Offer a menu after two failed attempts.
    • Escalate complaints, payments, sensitive cases, and low-confidence requests.
    • Give the user a ticket number and expected response time.
    • Let users type “agent”, “సిబ్బంది”, or a similar command to exit automation.

    A private deployment may be appropriate for legal, financial, or sensitive internal use cases; compare the trade-offs in this guide to building a private AI chatbot for lawyers.

    Test and measure before launch

    Create a test set of at least a few hundred messages spanning Telugu script, Romanised Telugu, code-mixing, typos, greetings, adversarial prompts, and out-of-scope questions. Measure:

    • Intent accuracy and entity extraction accuracy
    • Correct-answer and grounded-answer rate
    • Telugu language quality, judged by native reviewers
    • Median and 95th-percentile response time
    • Fallback, escalation, opt-out, and repeat-contact rates
    • Cost per resolved conversation

    Run tests against every model, prompt, glossary, and retrieval change. Red-team attempts to make the bot reveal system instructions or fabricate policy. Log minimal data, redact sensitive fields, define retention periods, and provide a clear privacy notice. Follow applicable Indian privacy and sectoral requirements with legal advice where necessary.

    Deploy a useful first version

    Launch with a narrow pilot—one customer segment, one workflow, and a small support team monitoring conversations. Use a managed container or virtual machine close to your users, HTTPS, health checks, alerts, backups, and a rollback path. Quantisation and caching can reduce inference costs, while a queue protects the webhook from traffic spikes.

    As of 2026, the strongest pattern for Indian-language chatbots remains small model plus retrieval plus deterministic tools, not unrestricted text generation. Expand only when the pilot shows stable accuracy, acceptable Telugu quality, and measurable business value. If you are building for India’s next wave of users, the broader product considerations in building AI apps for the next billion users in India are worth applying from the start.

    Frequently asked questions

    Do I need to train a model from scratch for Telugu?
    No. Start with a capable multilingual model, prompt and evaluate it, then fine-tune only if your labelled examples show a clear gap.

    Can a small model handle Telugu-English mixed messages?
    Often yes for narrow intents, but test code-mixed spelling and Romanised Telugu separately. A confidence threshold and fallback are essential.

    Is WhatsApp Cloud API free?
    Infrastructure and model costs still apply. Meta conversation pricing and template rules can change, so verify current commercial terms before budgeting.

    Should the chatbot answer every question?
    No. A trustworthy bot clearly states its scope, retrieves approved information, and hands off uncertain or sensitive requests.

    What should I build first?
    Choose one measurable workflow, such as FAQ resolution or appointment booking, and prove accuracy and response time before adding generative features.

    Last updated 23 September 2026

AIGI may be inaccurate. Replies seeded from the guide above.