Telegram Bot Handbook

So you’re developing a bot. How do you know what you can — and should — implement? There is a lot to consider:

  • The bot can show a “Send your phone number” button so the user won’t have to type it manually.
  • The bot shouldn’t @mention more than 5 users at once if you want all of them to receive a notification.
  • The easiest way to check if a user blocked the bot is trying to send the “is typing…” status.

So many details — and yet it’s hard a good description of Telegram bot features.

You can easily google for API methods, for sure: but you would spend hours to glue everything together and ensure that this can work. The unfortunate part is that it may still not work, because there is a lot of requirements and limitations.

So I’ve written a handbook that explains how Telegram bots work: handbook.tmat.me

It is neither a step-by-step tutorial nor an API reference. The handbook explains Telegram features and how to utilize them effectively to develop a complex and user-friendly bot.

A little history

In 2021 I published an article “Everything a Telegram Bot Developer Should Know” (in Russian) which overviewed features and limitations of Telegram Bot Platform and showed some development tricks. The article has got 600K+ views on habr.com, which is amazing.

However, I wanted to keep the material actual as Telegram Bot Platform was getting updates. Eventually, I wanted to gather even more info and more details. The article was no longer enough: I couldn’t edit it regularly and it would become too long to navigate.

So I started a site with pages and chapters.

Evolution of the handbook

The handbook has yet to become as popular as my original article: after all, I published that article on Habr, a popular Russian platform which does a great work with distribution. As of July 2024, my new site gets about 2000 visits per week.

I translated the handbook in English hoping that it will be useful for English-speaking developers. The translation still needs to be edited a lot. (Maybe I should utilize LLMs for this?)

I return to working on the handbook once in a while. If I have enough time and motivation, the next big improvement will be code examples on various libraries for all topics.

Technical details

The site has a public GitHub repository. It is built with a static site generator called VitePress and its default theme. VitePress is a awesome, by the way! My personal site which you’re reading right now is also made with VitePress, but, on the contrary, with custom CSS.

And I will again add the link to the handbook in case you’ve missed it:

handbook.tmat.me