Skip to main content

maxapi-sdk 0.13.0

maxapi-sdk is a production-ready Python SDK for the MAX Messenger Bot API.

The package is designed for teams that need a reliable foundation for bot development and operations: typed API access, resilient transport, polling and webhook runtimes, routing, middleware, FSM, plugin support, callback handling, and first-class media workflows.

Highlights

  • typed Bot API client for core MAX endpoints;
  • resilient transport with retries, backoff, and Retry-After support;
  • dedicated polling and webhook runtimes;
  • routing, middleware, composable filters, and dependency injection;
  • FSM primitives with in-memory storage;
  • plugin API for modular bot extensions;
  • structured callback payload parsing;
  • first-class media support for images, audio, voice, video, and files;
  • typed attachment helpers for outbound and inbound media handling;
  • GitHub Actions for test, build, and release automation.

Installation

pip install maxapi-sdk
pip install maxapi-sdk[webhook]
pip install maxapi-sdk[dev]

Quick start

import asyncio
import os

from maxapi import Bot, Command, Dispatcher


bot = Bot(token=os.environ["MAX_BOT_TOKEN"])
dispatcher = Dispatcher()


@dispatcher.message_created(Command("start"))
async def handle_start(event):
    await event.message.answer("Bot is running")


async def main() -> None:
    await dispatcher.start_polling(bot)


if __name__ == "__main__":
    asyncio.run(main())

Media workflows

from maxapi import Bot


async def send_media(bot: Bot) -> None:
    await bot.send_image("./assets/banner.png", chat_id=1001, text="Preview")
    await bot.send_voice(
        chat_id=1001,
        filename="voice.ogg",
        buffer=b"binary-audio-data",
        text="Voice update",
    )
    await bot.send_file("./reports/report.pdf", chat_id=1001, text="Report")

The SDK supports file path, bytes buffer, and stream-based uploads. Incoming attachments are exposed through typed accessors such as message.images, message.audios, message.voices, message.videos, and message.files.

Webhook runtime

import asyncio
import os

from maxapi import Bot, Dispatcher


bot = Bot(token=os.environ["MAX_BOT_TOKEN"])
dispatcher = Dispatcher()


async def main() -> None:
    await dispatcher.handle_webhook(
        bot=bot,
        host="0.0.0.0",
        port=8080,
        path="/webhook",
        secret=os.environ["MAX_BOT_WEBHOOK_SECRET"],
    )


if __name__ == "__main__":
    asyncio.run(main())

FSM example

from maxapi import Dispatcher, MemoryStorage, State, StateFilter, StatesGroup


class Registration(StatesGroup):
    name = State()
    confirm = State()


dispatcher = Dispatcher(storage=MemoryStorage())


@dispatcher.message_created(StateFilter(Registration.name))
async def handle_name(message, state):
    await state.update_data(name=message.body.text)
    await state.set_state(Registration.confirm)
    await message.answer("Please confirm the entered name")

Packaging and release

The repository includes CI workflows for tests, package build validation, GitHub Releases, and PyPI publication via Trusted Publishing.

Compatibility

The public import path remains maxapi, while the distribution package name is maxapi-sdk.

Metadata

Release files for maxapi-sdk 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maxapi-sdk 0.13.0
File Size Uploaded Provenance Actions
maxapi_sdk-0.13.0.tar.gz 37.3 kB With provenance Details for maxapi_sdk-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maxapi-sdk 0.13.0
File Interpreter ABI Platform Actions
maxapi_sdk-0.13.0-py3-none-any.whl Python 3 none any Details for maxapi_sdk-0.13.0-py3-none-any.whl

Total release size: 79.2 kB

Release files / maxapi_sdk-0.13.0.tar.gz

Download URL maxapi_sdk-0.13.0.tar.gz
Size 37.3 kB
Tags Source
SHA-256 checksum
How to use checksums
31580f222e14b04bd652c2d4dc3b02c44e09986ef349c944651dee449b0f1217
BLAKE2b-256 checksum
How to use checksums
fc1ea9abd5e878847aabc09fb0d6c46ef413d2d77f0e0b0e6cc2d46ad903d289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.

Transparency log

Release files / maxapi_sdk-0.13.0-py3-none-any.whl

Download URL maxapi_sdk-0.13.0-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebf554504f224a7511263004fb953a5d3eb8f137ca900dd89af9754336876843
BLAKE2b-256 checksum
How to use checksums
40a21d38d4fc894bf1193998c0d85b1e80450cf4d65da563d8fb743012df8ead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.

Transparency log

Security for maxapi-sdk 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for maxapi_sdk-0.13.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page