Skip to content

Events

events

MessageEvent dataclass

MessageEvent(
    chat_jid: str,
    sender_jid: str,
    message_id: str,
    text: str | None = None,
    media: MediaInfo | None = None,
    timestamp: int | None = None,
    from_me: bool = False,
    sender_key: bool = False,
    raw: Node | None = None,
)

A decrypted incoming message: text, an attachment, or both.

ReactionEvent dataclass

ReactionEvent(
    chat_jid: str,
    sender_jid: str,
    message_id: str,
    text: str,
    from_me: bool = False,
    timestamp: int | None = None,
    raw: Node | None = None,
)

An emoji reaction; text is empty when the reaction was retracted.

HistorySyncEvent dataclass

HistorySyncEvent(
    sync_type: int,
    chats: int,
    messages: int,
    chunk_order: int = 0,
    has_more: bool = False,
)

One history chunk was stored: messages the bot never saw live.

ReceiptEvent dataclass

ReceiptEvent(
    chat_jid: str,
    sender_jid: str,
    message_ids: tuple[str, ...],
    receipt_type: str,
    timestamp: int | None = None,
    raw: Node | None = None,
)

Delivery or read confirmation, for one message or a batch of them.

ChatStateEvent dataclass

ChatStateEvent(
    jid: str,
    state: str,
    media: str | None = None,
    raw: Node | None = None,
)

Typing indicator: composing (optionally recording audio) or paused.

NotificationEvent dataclass

NotificationEvent(
    kind: str,
    attrs: dict[str, str] = dict(),
    raw: Node | None = None,
)

Server-side notification we do not model yet (device changes, sync, ...).