Build a Telegram bot that responds to user commands and echoes messages in about 10 lines of Python code.
Create an async bot that handles many concurrent Telegram messages without blocking, for high-traffic bots.
Send files, photos, polls, or payments through a Telegram bot using the library's API wrappers.
Add a Telegram notification or command interface to an existing Python app or automation script.
Requires creating a Telegram bot via BotFather to get an API token before writing any code.
pyTelegramBotAPI is a Python library for building Telegram bots. Telegram provides an official Bot API that lets you create automated accounts that can send and receive messages, respond to commands, send files, create polls, handle payments, and do many other things within Telegram chats. This library wraps that API so that Python developers can write bot logic without having to handle the underlying HTTP calls directly. The library supports both regular (synchronous) and asynchronous programming styles. In the synchronous style, your code runs one step at a time in order. In the asynchronous style, your code can handle multiple incoming messages at once without waiting for each one to finish, which is better for bots that expect a lot of traffic. Both modes expose the same features. To use the library, you create a bot account through Telegram's BotFather tool and receive an API token. You then write Python code that registers message handlers: functions that run automatically when certain types of messages arrive. A simple echo bot, which the README walks through step by step, takes about 10 lines of code. Handlers can filter by command, message content, or any custom condition you define. The library is installed via pip, the standard Python package installer, and works with Python 3.10 through 3.14. It is kept up to date with Telegram's Bot API as Telegram releases new features. The README includes a thorough table of contents covering topics like inline mode, webhooks, middleware, proxy support, and how to send large text messages in chunks. The project has official documentation hosted on Read the Docs, available in both English and Russian. It is described as production-ready but still actively developed. The full README is longer than what was shown.
← eternnoir on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.