Core Concepts#
This page explains the core building blocks of Waton before you dive into APIs.
Architecture at a glance#
Waton has two main layers:
High-level App API -
Appgives decorator-based handlers (@app.message(...)) and context helpers (ctx.reply(...)). - Best for bot development and application logic.Low-level WAClient API -
WAClienthandles transport, authentication, protocol nodes, and normalized events. - Best for advanced control, custom pipelines, and protocol-level debugging.
Supporting APIs (available from App):
MessagesAPIfor sending messagesGroupsAPIfor group operationsChatsAPIfor profile/privacy/chat modificationsNewsletterAPIfor channel/newsletter featuresPresenceAPIfor presence updates
Message model#
Incoming messages are parsed into a rich Message entity with fields such as:
identity:
id,from_jid,participanttext/media:
text,media_urlprotocol updates:
protocol_type,target_message_id,edited_textadvanced encrypted add-ons:
poll_update,event_response,encrypted_reactioncontent metadata:
content_type,content,message_secret_b64
This model is what Context.message exposes in App handlers.
App vs WAClient: when to use which#
Use App when:
You want fast bot development with decorators and filters.
You mostly care about message handling and replies.
Use WAClient when:
You need normalized events from receipts/notifications/calls/acks.
You need detailed lifecycle control and protocol-level visibility.
Important limitation in high-level mode#
App dispatches only nodes tagged message into router handlers. Non-message
node types (for example receipt/notification/call/ack/ib) are not routed via
@app.message handlers. For those, use low-level client.on_event.
Next steps#
Connection and QR/auth lifecycle: Connection Lifecycle
Event names and payload categories: Event Model
Message categories and parsing behavior: Message Model