Production-ready Python SDK for MAX Messenger Bot API
Project description
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-Aftersupport; - 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maxapi_sdk-0.13.0.tar.gz.
File metadata
- Download URL: maxapi_sdk-0.13.0.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31580f222e14b04bd652c2d4dc3b02c44e09986ef349c944651dee449b0f1217
|
|
| MD5 |
889d51d62c9fbe3936675444f96aa401
|
|
| BLAKE2b-256 |
fc1ea9abd5e878847aabc09fb0d6c46ef413d2d77f0e0b0e6cc2d46ad903d289
|
Provenance
The following attestation bundles were made for maxapi_sdk-0.13.0.tar.gz:
Publisher:
publish.yml on Maxi-online/maxapi-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maxapi_sdk-0.13.0.tar.gz -
Subject digest:
31580f222e14b04bd652c2d4dc3b02c44e09986ef349c944651dee449b0f1217 - Sigstore transparency entry: 1194577948
- Sigstore integration time:
-
Permalink:
Maxi-online/maxapi-sdk@e00d572b60f8bad41e312b1b9974c6bb035cd5b8 -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/Maxi-online
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e00d572b60f8bad41e312b1b9974c6bb035cd5b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file maxapi_sdk-0.13.0-py3-none-any.whl.
File metadata
- Download URL: maxapi_sdk-0.13.0-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebf554504f224a7511263004fb953a5d3eb8f137ca900dd89af9754336876843
|
|
| MD5 |
c12185c8e229e7adca8a56d18fda5819
|
|
| BLAKE2b-256 |
40a21d38d4fc894bf1193998c0d85b1e80450cf4d65da563d8fb743012df8ead
|
Provenance
The following attestation bundles were made for maxapi_sdk-0.13.0-py3-none-any.whl:
Publisher:
publish.yml on Maxi-online/maxapi-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maxapi_sdk-0.13.0-py3-none-any.whl -
Subject digest:
ebf554504f224a7511263004fb953a5d3eb8f137ca900dd89af9754336876843 - Sigstore transparency entry: 1194577977
- Sigstore integration time:
-
Permalink:
Maxi-online/maxapi-sdk@e00d572b60f8bad41e312b1b9974c6bb035cd5b8 -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/Maxi-online
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e00d572b60f8bad41e312b1b9974c6bb035cd5b8 -
Trigger Event:
push
-
Statement type: