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.
| 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 |
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
webhook_url and TELEGRAM_TOKEN are
in your .env.python set_webhook.py && python -m app.telegram_bot/telegram route for Telegram Webhook.uptimerobot.com ping if you want to keep the bot
alive..ogg Telegram voice message.wav using pydubSpeechRecognition (Sphinx)gTTS)session_db.py handles storing user context
(context:{chat_id}) and history
(history:{chat_id})MAX_HISTORY_LEN)static/miniapp/index.htmlWebAppInfo inside
/start replypython -m app.telegram_botlogging.info(...) to track handler activitytry/except for graceful
failure_cache in
memoryMIT 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.