How to Choose a Telegram Bot Library
Most developers use a library instead of calling Telegram with raw HTTP requests. Start by deciding whether Bot API is enough or you need Telegram API features.
If you are building a regular bot, Bot API libraries are usually enough. Choose them when you want an easy start, good documentation, and many language options.
Telegram API libraries are useful when you need features Bot API does not provide: fetching old messages, working with larger files, fetching group members, or running several bot programs at once. Use the API comparison page when this choice affects the bot design.
Choose a Bot API library for regular bots
A common Python choice is aiogram.Rocketgram is an alternative.
JavaScript is often used as well: check out Telegraf or GrammY.
Bot API libraries exist for many other languages, too. The official site has a list and seems to keep it up-to-date.
Choose a Telegram API library for API-only features
For Python, the most popular library built with Telegram API is Telethon. Since Telethon isn't primarily focused on bot development, I created the Folds framework, which builds on top of Telethon and helps you create simple and scalable bots.
For JavaScript, the options include mtcute or GramJS.
Start with a private echo bot
Here's a simple bot that echoes the user's messages in DM:
from folds import Bot, Message
bot = Bot(bot_token='YOUR_BOT_TOKEN_HERE', api_id=123456, api_hash='YOUR_API_HASH')
@bot.private_message
async def echo(text: str):
return text
if __name__ == '__main__':
bot.run()