Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

chattolib

Unofficial async Python client library for the Chatto webchat API.

Chattolib versions track the Chatto server version they target. The current release targets Chatto's ConnectRPC API. Request/response traffic uses the official connectrpc Python package; the realtime channel is a binary protobuf WebSocket at /api/realtime (needs the [realtime] extra).

chattolib is a bot library. It drives bot accounts, which authenticate with a key used directly as a bearer token (no password, no /auth/login round-trip). Normal humans use the Chatto web app; you reach the API here as a bot. See the bot guide.

Install

pip install chattolib

Quick start

import asyncio
from chattolib import ChattoClient


async def main():
    # Public discovery — no auth required
    async with ChattoClient() as anon:
        profile, login = await anon.get_server()
        print(f"Chatto {profile.version}: {profile.name}")

    # Authenticated calls — a bot key is used directly as a bearer token
    async with ChattoClient(token="cht_BK_...") as client:
        me = await client.me()
        print(f"Authenticated as {me.display_name}")

        for entry in await client.list_rooms():
            if entry.room:
                print(f"  - {entry.room.name}")


asyncio.run(main())

For a full bot (event handlers, say/reply/react, presence, auto-join), use the higher-level :class:~chattolib.bot.Bot facade — see docs/bots.md.

Realtime

Install with the extra:

pip install 'chattolib[realtime]'

Then stream live events:

from chattolib import stream_events

async with ChattoClient(token="cht_BK_...") as client:
    async for event in stream_events(client):
        print(event.kind, event.actor_id, event.payload)

event.kind names the protobuf oneof case (message_posted, reaction_added, presence_changed, notification_created, …). event.payload is the concrete protobuf sub-message — access its fields directly (e.g. event.payload.room_id). Realtime events are invalidation signals; use the corresponding Connect RPC (GetRoomEventsAround, GetNotification, GetUser, …) to hydrate the referenced resource.

Escape hatch

ChattoClient.services exposes the underlying connectrpc service clients directly (one per Chatto service), for anything the Pythonic wrappers don't yet cover. For example:

from chattolib._pb.chatto.api.v1 import messages_pb2

resp = await client.services.messages.get_message(
    messages_pb2.GetMessageRequest(room_id=..., event_id=...)
)

License

  • chattolib's own code is licensed under MPL-2.0 (Mozilla Public License 2.0) — a weak, file-level copyleft. You can use, distribute, and embed chattolib in commercial or proprietary software; modifications to the library's own files must be released under MPL-2.0.
  • Vendored Chatto protobuf definitions under proto/chatto/** and the generated bindings under src/chattolib/_pb/chatto/** are Apache-2.0, matching upstream chattocorp/chatto.
  • Vendored buf.validate material is Apache-2.0 (from bufbuild/protovalidate).

See LICENSING.md for the full picture and REUSE.toml for the machine-readable licence map.

Note: chattolib versions 0.0.1 through 0.4.9 were released under MIT. Those releases remain MIT-licensed forever on PyPI; the MPL-2.0 relicence applies to newly published releases only.

Download files

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

Source Distribution

chattolib-0.5.0a4.post1.tar.gz (137.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chattolib-0.5.0a4.post1-py3-none-any.whl (173.0 kB view details)

Uploaded Python 3

File details

Details for the file chattolib-0.5.0a4.post1.tar.gz.

File metadata

  • Download URL: chattolib-0.5.0a4.post1.tar.gz
  • Upload date:
  • Size: 137.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for chattolib-0.5.0a4.post1.tar.gz
Algorithm Hash digest
SHA256 4991463b15857403173fdb718f4af6b57338723c371799ca346e927e703aeb5a
MD5 63cc85f9ab14b479e7815c71d2807940
BLAKE2b-256 21b1f421c6dddbddf7f36430abf1cc10d2223e4202ed2ee480eff7258cfd31f6

See more details on using hashes here.

File details

Details for the file chattolib-0.5.0a4.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for chattolib-0.5.0a4.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa62ccd320b14baf4b53c18beb9d49de282abb349c724fecb6654491f23f4b0a
MD5 cb544b33f035fc048570d7d3b60d6f2e
BLAKE2b-256 caeaa8650231b57bf8f75531a96356121cae49a9be38093503db6e055f761b7a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0a4.post1 This release

2 files

0.4.20.post1

2 files

0.4.20

2 files

0.4.19.post3

2 files

0.4.19.post2

2 files

0.4.19.post1

2 files

0.4.19

2 files

0.4.11

2 files

0.4.10

2 files

0.4.9.post1

2 files

0.4.9

2 files

0.4.3

2 files

0.4.2.post2

2 files

0.4.2.post1

2 files

0.4.2

2 files

0.3.4

2 files

0.1.0b3

2 files

0.0.1

1 file

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