Parvej Ahmed — Full Stack Developer, Mentor, Founder & Creative Designer

How I Built an AI Telegram Bot Used by Hundreds of Students

By Parvej Ahmed · 2026-05-06

A behind-the-scenes look at building an AI Telegram bot in Node.js with the OpenAI API — architecture, rate limiting, costs and lessons learned.

The idea

Students in Bangladesh wanted a free, fast way to ask questions, get summaries and translate text — without juggling multiple apps. Telegram is everywhere here, so I built the bot inside Telegram.

Architecture

Node.js + Telegram Bot API + OpenAI + MongoDB for per-user history and rate limits. Hosted on a small VPS, behind a webhook.

Rate limiting

Per-user token quotas reset daily. Heavy commands like image generation cost more credits.

Multi-language support

Bangla and English are first-class. The bot detects language and responds accordingly.

Lessons learned

  • Cache aggressively. LLM calls are slow and expensive.
  • Stream responses where possible.
  • Build admin commands from day one.

What is next

I am open-sourcing parts of the codebase and writing a step-by-step tutorial soon.