Every part of Bale, in one async client.
bale xyz is a complete Python client for the Bale messenger (بله). User sessions, bot tokens, voice calls, and typed access to all 683 internal RPCs — rebuilt at import time from the official web protocol, with no generated boilerplate to maintain.
Why this library
Most Bale clients either stop at the Bot API or hard-code a handful of
endpoints. bale xyz takes the third path: it reconstructs the entire
protocol description from the public web bundle, then builds real protobuf
messages at runtime. That means every RPC — even the obscure ones like
bale.kifpool.v1.Kifpool — produces a proper typed request, and a
new Bale release only requires regenerating one index file.
Voice-first conferences
All 30 bale.meet.v1.Meet methods wrapped, with payloads verified byte-for-byte against a real browser capture.
Three ways to authenticate
Phone + SMS code, an exported user_id:jwt string, or scraping the session straight out of a local browser.
Bots and users, one API
Pass a bot token and the same Client speaks the Telegram-style Bot API. Sessions and bots coexist.
Nothing is unreachable
Every RPC without a convenience wrapper is one client.call(...) away, with typed encoding handled for you.
How it fits together
Five layers, each usable on its own:
| Layer | What it gives you | Module |
|---|---|---|
| Protocol | 683 request + 683 response protobuf types, built at import from index.json | dynamic.py, proto/ |
| Transport | Multiplexed WebSocket with request indices; gRPC-web for auth and uploads | transports/ |
| RPC | call(service, method, payload) → parsed response message | rpc.py |
| Client | 74 high-level methods: messages, media, chats, calls | client.py |
| Framework | Events, filters, dispatcher, FSM — Telethon and Pyrogram styles | events.py, filters.py, fsm.py |
What is verified, and what is not
The protocol, transports, encoders and conference payloads are verified
against a real browser capture (a .har file) and a live
handshake. But no end-to-end login with a real account was performed during
development. The first thing you should run with your own credentials is
await client.start() followed by {" "}
await client.create_meet_link().
| Area | Status | Evidence |
|---|---|---|
| Protobuf encoding | verified | Byte-identical to captured frames for GenerateCallLink, GetWssURL, JoinGroupCall, SetLinkTitle |
| WebSocket handshake metadata | verified | All 12 key_values match the browser exactly |
| Auth flow | live handshake | Reached Bale's servers; returned a real transactionHash and code 4401 |
| gRPC-web transport | live handshake | Real transactionHash received over HTTP/2 |
| Bot API | live 401 | Request reaches tapi.bale.ai and is rejected with the expected auth error |
| Full logged-in session | untested | Needs your credentials |