Skip to main content

Asynchronous library for Telegram bot API

Project description

Key Features

  • Asyncio and aiohttp based
  • All Telegram Bot API types and methods supported
  • Bot API rate limit support
  • Both long polling and webhooks supported
  • Fully type annotated (PEP 484)


aiotgbot is available on PyPI. Use pip to install it:

pip install aiotgbot


Using aiotgbot

from typing import AsyncIterator

from aiotgbot import (Bot, BotUpdate, HandlerTable, PollBot,
                      PrivateChatFilter, Runner)
from aiotgbot.storage_memory import MemoryStorage

handlers = HandlerTable()

async def reply_private_message(bot: Bot, update: BotUpdate) -> None:
    assert update.message is not None
    name = (f'{} '
    await bot.send_message(, f'Hello, {name}!')

async def run_context(runner: Runner) -> AsyncIterator[None]:
    storage = MemoryStorage()
    await storage.connect()
    bot = PollBot(runner['token'], handlers, storage)
    await bot.start()


    await bot.stop()
    await storage.close()

def main() -> None:
    runner = Runner(run_context)
    runner['token'] = 'some:token'

if __name__ == '__main__':

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiotgbot, version 0.10.8
Filename, size File type Python version Upload date Hashes
Filename, size aiotgbot-0.10.8-py3-none-any.whl (37.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiotgbot-0.10.8.tar.gz (31.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page