Telethon
Full-featured Telegram client library for Python 3
What it is and what it does
Telethon wraps Telegram's MTProto protocol in a Python 3 asyncio library, letting you write programs that send messages, download media, handle events, and automate interactions with Telegram accounts or bots. It handles the cryptographic and protocol complexity so you can focus on application logic rather than low-level API details.
The library supports both user accounts and bot accounts, offering an alternative to Telegram's official bot API when you need user-level access or more direct control. It requires obtaining API credentials from Telegram's developer portal and respects Python 3.5 and later. The two core dependencies (pyaes for encryption and rsa for key handling) are lightweight, keeping installation straightforward.
Use it for:
- Automate sending messages or files to Telegram contacts or groups from a Python script.
- Build a bot that listens for incoming messages and responds to patterns or commands.
- Download and archive media from Telegram conversations programmatically.
- Monitor a Telegram channel or group and trigger actions based on new messages.
- Migrate data or integrate Telegram messaging into a larger application workflow.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Telethon is an asyncio-based Python library that implements the MTProto protocol to interact with Telegram's API as a user account or bot, providing an alternative to Telegram's official bot API.
Yes, if you need to interact with Telegram from Python and can obtain API credentials. The library is actively maintained, has low install friction, carries no known vulnerabilities, and is MIT-licensed. Be aware that Telegram's ToS prohibit certain uses and account bans are possible—read the documentation's compatibility and FAQ sections before deploying to a production account.
Install
telethon on PyPI
pip
pip install telethonuv
uv add telethonpoetry
poetry add telethonInstalling Telethon
Before you install
Low install friction with only two runtime dependencies (pyaes, rsa). Maintenance status is active with a release within the last 60 days. The library is in maintenance mode for v1, accepting bug fixes and layer updates.
License in practice
MIT license permits commercial and private use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install telethon
from telethon import TelegramClient, events
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = TelegramClient('session_name', api_id, api_hash)
client.start()
client.send_message('username', 'Hello from Telethon')
You must obtain api_id and api_hash from https://my.telegram.org under API Development before the client can connect.
Verify before relying
- Whether account bans or limitations occur in practice when using the library, despite ToS warnings in the documentation.
- Current compatibility with the latest Telegram protocol changes beyond what the release date suggests.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pyaes, rsa |
| Maintenance | actively maintained — 60 days since the last release |
| First released | |
| Downloads | 3,727,765/month — #2,515 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: telethon-1.44.0-py3-none-any.whl
Keywords: api, chat, client, library, messaging, mtproto, telegram
Tags
More Chat packages
Provides Python bindings for Slack's Web API,…
permissive · top 1,000 on PyPI
python-telegram-botProvides a pure Python asynchronous interface…
copyleft · top 1,000 on PyPI
slackclientProvides Python interfaces to Slack's Web API…
permissive · top 5,000 on PyPI
aiogramaiogram is an asynchronous Python framework for…
permissive · top 5,000 on PyPI
mleapSerializes and deserializes machine learning…
permissive · top 5,000 on PyPI
open-webuiOpen WebUI is a self-hosted AI platform…
unclear · top 5,000 on PyPI
pytgcallsEnables Python bots to join Telegram voice…
copyleft · top 5,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
PyrogramPyrogram is an asynchronous Python framework…
copyleft · top 15,000 on PyPI
pyTelegramBotAPIA Python library that wraps the Telegram Bot…
copyleft · top 5,000 on PyPI
telebotA Telegram bot library with route-based message…
permissive · top 15,000 on PyPI
TgCryptoTgCrypto provides fast C-based implementations…
copyleft · top 15,000 on PyPI
nonebot2NoneBot2 is an asynchronous Python framework…
permissive · top 15,000 on PyPI