pyTelegramBotAPI
Python Telegram bot API.
What it is and what it does
pyTelegramBotAPI is a Python wrapper around the Telegram Bot API that lets you build bots without directly managing HTTP requests. It abstracts away API calls into a simple class-based interface with decorators for message handling, supporting both blocking (synchronous) and non-blocking (asynchronous) patterns. The library handles message routing, reply markup, inline queries, callback buttons, and other Telegram-specific features like polls and payment workflows.
You define handlers—functions decorated with filters that match incoming messages—and the library dispatches incoming updates to the right handler. It manages the polling loop or webhook setup to keep your bot listening for messages. With aiohttp and requests as its only runtime dependencies, it stays lightweight while supporting modern Python versions from 3.10 onward.
Use it for:
- Build a command-driven bot that responds to /start, /help, and custom commands with static or dynamic replies.
- Create an interactive bot with inline keyboards and callback queries for user navigation and form submission.
- Set up a notification or alert bot that sends messages to users or channels based on external events or schedules.
- Develop a bot that processes media (photos, documents, audio) and performs actions like storage, analysis, or forwarding.
- Implement a polling-based or webhook-based bot that scales to handle multiple concurrent user conversations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python library that wraps the Telegram Bot API, providing both synchronous and asynchronous interfaces to build bots that send messages, handle user interactions, and manage Telegram chat operations.
Yes, with conditions. The library is actively maintained, has no known vulnerabilities, and is production-stable for building Telegram bots. However, the GPLv2 copyleft license requires that any application using it be open-source or compatible with GPL terms—a significant constraint for proprietary projects. If your use case permits GPL licensing, this is a solid, well-established choice.
Install
pytelegrambotapi on PyPI
pip
pip install pytelegrambotapiuv
uv add pytelegrambotapipoetry
poetry add pytelegrambotapiInstalling pyTelegramBotAPI
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release and has been in development since 2015, indicating stable, long-term support.
License in practice
Licensed under GPLv2 (copyleft). Any derivative work or application that bundles this library must also be distributed under GPLv2 or a compatible license, which may restrict commercial or proprietary use.
Quickstart
pip install pyTelegramBotAPI
import pytelegrambotapi
bot = pytelegrambotapi.TeleBot("YOUR_BOT_TOKEN")
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, "Hello!")
bot.infinity_polling()
Requires a Telegram Bot API token obtained from @BotFather on Telegram; Python 3.10 or later.
Verify before relying
- Whether the library fully supports all current Telegram Bot API features or has known limitations beyond those documented.
- Performance characteristics when handling high-volume message throughput or concurrent async operations.
- Whether middleware and custom filter systems are production-ready for complex bot logic.
Package facts
| License | GPL2 (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — aiohttp, requests |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,212,302/month — #4,212 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytelegrambotapi-4.36.1-py3-none-any.whl
Keywords: api, bot, telegram, tools
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
aiogramaiogram is an asynchronous Python framework for…
permissive · top 5,000 on PyPI
python-telegram-botProvides a pure Python asynchronous interface…
copyleft · top 1,000 on PyPI
telebotA Telegram bot library with route-based message…
permissive · top 15,000 on PyPI
twitchAPIA Python client library for the Twitch Helix…
permissive · top 15,000 on PyPI
TelethonTelethon is an asyncio-based Python library…
permissive · top 5,000 on PyPI
PyrogramPyrogram is an asynchronous Python framework…
copyleft · top 15,000 on PyPI
pyroforkPyrofork is an asynchronous Python framework…
copyleft · top 15,000 on PyPI
KurigramKurigram is an asynchronous Python framework…
copyleft · top 15,000 on PyPI
rlbotRLBot is a framework for writing Python bots…
permissive · top 15,000 on PyPI
nonebot2NoneBot2 is an asynchronous Python framework…
permissive · top 15,000 on PyPI