HappyBot: A Multimodal Generative AI Telegram Assistant

HappyBot is a Telegram bot designed to provide emotional support, wellness check-ins, and intelligent conversations using a Generative AI backend (SEA-LION LLM). The bot integrates a Mini App (Telegram Web App), handles both text and voice input, and is deployed using webhook mode on Render.com.


๐Ÿ“Œ Features


โš™๏ธ Tech Stack

Component Tech Used
Backend Python, Flask (for webhook), Telegram Bot API
AI Model SEA-LION (via HTTP API)
LLM Prompting LangChain + Custom Templates
Voice Input speech_recognition (Sphinx) + pydub
TTS Response gTTS (Google Text-to-Speech)
Mini App Telegram WebApp + static HTML/JS
Hosting Render.com (Webhook mode)
Storage Redis or in-memory fallback

๐Ÿ“ Directory Structure

app/
โ”‚
โ”œโ”€โ”€ telegram_bot.py       # Main app entrypoint
โ”œโ”€โ”€ session_db.py         # Redis/memory store for user sessions
โ”œโ”€โ”€ langchain_prompts.py  # Prompt formatting using LangChain
โ”œโ”€โ”€ sea_lion_api.py       # Wrapper around SEA-LION HTTP API
โ”œโ”€โ”€ templates/            # MiniApp HTML templates (optional)
โ”œโ”€โ”€ static/               # JS/CSS assets for Mini App
โ””โ”€โ”€ .env                  # Secrets and environment variables

๐Ÿš€ Deployment on Render

  1. Set up a Python Web Service on Render.
  2. Ensure webhook_url and TELEGRAM_TOKEN are in your .env.
  3. Use the following startup command:
python set_webhook.py && python -m app.telegram_bot
  1. Expose /telegram route for Telegram Webhook.
  2. Add uptimerobot.com ping if you want to keep the bot alive.

๐Ÿ”Š Voice Input


๐Ÿง  Context & Memory


๐Ÿงฉ Telegram Mini App


๐Ÿงช Testing & Debugging Tips


๐Ÿค Contributing


๐Ÿ“„ License

MIT License โ€“ Use freely and improve for good ๐ŸŒ


HappyBot is a capstone example of combining Generative AI, chat interfaces, multimodal input, and cloud deployment to solve real human needs.