Skip to content
Asynchronous TamTam messenger's cool BotAPI python wrapper
Branch: master
Clone or download


👮‍♂️ requires ujson, pydantic, aiohttp

pip install

ℹ️ Setting bot-info:

from tamtam import Bot, types, run_async

Bot("put token @PrimeBot gave")

async def func():
    info = await types.SetInfo(


Polling TamTam for updates

from tamtam import Bot, Dispatcher, types, run_poller

bot = Bot("put token @PrimeBot gave")
dp = Dispatcher(bot)

async def msg_handler(msg: types.Message):
    await msg.reply("Hello!")


☂️ Write fancy decorators

async def start_handler(upd: types.BotStarted):
    await upd.respond("you started bot")

👟👞 Easily switch from polling to webhook

from tamtam import Bot, Dispatcher, types, run_sever

bot = Bot("token")
dp = Dispatcher(bot)

async def handler(upd: types.BotStarted):
    await upd.respond("Sup!")


If not configured:

# better example in repo/examples/
async def sub(url):
    if not (await bot.subscribe(url))["success"]:
        # something went wrong

url = "https://my.domain/path"  # or use

from tamtam import run_async

Easy function based message filters

@dp.message_handler(MessageFilters.match(r"^.ban \d$"))
async def ban_user_handler(message: types.Message):


You can use tamtam.types.attachments::InlineKeyboardAttachment, but ... I find it quite inconvenient to utilize and, that's why we have tamtam.types.attachments::ButtonsArray Think of ButtonsArray as an abstraction from list[list[button]].

from tamtam.buttons import ButtonsArray, CallbackButton, InlineKeyboardAttachment

array = ButtonsArray()
row, index = array.add_row(1)  # pass None for dynamic row
row.add(CallbackButton("text", "payload", "negative"))
row2, index2 = array.add_row(1)


# further actions, e.g send message
attachments = (InlineKeyboardAttachment.from_array(array), )

Bots using

GetJson this bot returns sent message's json (useful for developers or no)

See examples for more.

If your bot using, let me know!

Some advices from author

  • Try to avoid using webhooks :) For safety.
  • I prohibit using other libraries for tamtam (I checked them all. It's for your sake, python coders are brainless today).
  • async/await syntax is easy. asyncio does not eat people. Stay modern.
You can’t perform that action at this time.