MatterAio
Async Python client for the Mattermost REST API and WebSocket events.
MatterAio is intentionally small and explicit:
- async-only
- thin wrapper over Mattermost API v4
- no hidden multi-step workflows
- typed responses with Pydantic models
Installation
With pip:
pip install matteraio
With Poetry:
poetry add matteraio
With uv:
uv add matteraio
Quick Start
Create a bot token in Mattermost and pass it to MattermostClient.
import asyncio
from matteraio import MattermostClient
async def main() -> None:
async with MattermostClient(
base_url="https://mattermost.example.com",
token="YOUR_BOT_TOKEN",
) as client:
bot = await client.init_session()
print(bot.username)
team = await client.teams.get_by_name("engineering")
channel = await client.channels.get_by_name(team.id, "town-square")
post = await client.posts.create(
channel_id=channel.id,
message="Hello from matteraio",
)
thread = await client.posts.thread(post.id)
users = await client.users.search("alice", team_id=team.id, limit=10)
print(post.id, len(thread.posts), [user.username for user in users])
asyncio.run(main())
If you need login/password authentication instead of a bot token, construct the client without
token and call client.users.login(...). Token changes inside one client instance are not
supported; create a new client when credentials change.
Pagination Helpers
Paginated list endpoints can be consumed page by page with the regular list(...) methods, or
as async iterators when you want all items until Mattermost returns a short or empty page.
async for channel in client.channels.iter_all(team.id, per_page=100):
print(channel.name)
async for post in client.posts.iter_channel(channel.id, per_page=100):
print(post.message)
WebSocket Handlers
Use routers and decorators to handle incoming WebSocket events.
from matteraio import MattermostEventDispatcher, MattermostWebSocketClient, PostedEvent
dispatcher = MattermostEventDispatcher()
@dispatcher.on(PostedEvent)
async def on_posted(event: PostedEvent) -> None:
print(event.data.post.message)
async def main() -> None:
async with MattermostWebSocketClient(
base_url="https://mattermost.example.com",
token="YOUR_BOT_TOKEN",
) as websocket:
await dispatcher.start(websocket)
Documentation
- Endpoint reference: REST docs split by Mattermost API area, plus WebSocket and handler references.
Development
Install development dependencies:
uv sync --all-groups
Run local checks:
uv run ruff format .
uv run ruff check .
uv run mypy src tests
uv run pytest
Run opt-in integration tests against a local Mattermost preview server:
docker compose -f docker-compose.integration.yml up -d
MATTERAIO_RUN_INTEGRATION=1 uv run pytest tests/integration -m integration
docker compose -f docker-compose.integration.yml down -v
Set MATTERAIO_BASE_URL to override the default integration server URL.
Metadata
Release files for matteraio 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| matteraio-1.1.3.tar.gz | 29.6 kB | With provenance | Details for matteraio-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matteraio-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for matteraio-1.1.3-py3-none-any.whl |
Total release size: 59.2 kB
Release files / matteraio-1.1.3.tar.gz
| Download URL | matteraio-1.1.3.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98615f4e9c155b2d4223cb736fd1e28cf2dc0076e975947aafd49903e6f7f676
|
|
BLAKE2b-256 checksum How to use checksums |
cdc2a85a7edeae71d626ca7b2e14146b0c78c3437be3fbc7bcc7085da450459f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 31, 2026.
Transparency logRelease files / matteraio-1.1.3-py3-none-any.whl
| Download URL | matteraio-1.1.3-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
839392bdf9824cfa768bfe13bc0ca633498f0619c8d8cf41b79b7316556a0777
|
|
BLAKE2b-256 checksum How to use checksums |
6f2e829c540bfdeea40016bb78a4781c448e8218ea22b112c74da8ccc0e03c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 31, 2026.
Transparency logSecurity for matteraio 1.1.3
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.
Attestation for matteraio-1.1.3.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 Aug 31, 2026.
Transparency logA 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.