skillfed

pyTelegramBotAPI

Python Telegram bot API.

pytelegrambotapi v4.36.1 1.2M downloads/30d#4,212 on PyPI8,763
Copyleft license GPL2 Active released

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 pytelegrambotapi

uv

uv add pytelegrambotapi

poetry

poetry add pytelegrambotapi

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

telegram bot api pythonbuild telegram botstelegram bot libraryasync telegram bottelegram message handlertelegram bot frameworkpython telegram automation
telegram-botasync-supportmessage-handling

More Internet packages