Skip to main content

Events

WhatsmeowClient extends EventEmitter and emits typed events. All whatsmeow events are forwarded.

Usage

client.on("message", ({ info, message }) => { /* ... */ });
client.on("connected", ({ jid }) => { /* ... */ });

Connection Events

EventPayloadDescription
connected{ jid: string }WhatsApp connection established. Safe to send messages.
disconnected{}Connection lost. Auto-reconnect is automatic.
logged_out{ reason: string }Session revoked. Must re-pair.
stream_error{ code: string }Protocol error. Usually followed by auto-reconnect.
temporary_ban{ code: string, expire: string }Temporary ban from WhatsApp.
keep_alive_timeout{ errorCount: number }Keep-alive pings failing. Connection may be degraded.
keep_alive_restored{}Keep-alive recovered. Connection is healthy.

Message Events

EventPayloadDescription
message{ info: MessageInfo, message: Record<string, unknown> }New message received.
message:receipt{ type: string, chat: string, sender: string, isGroup: boolean, ids: string[], timestamp: number }Read/delivery receipt.

MessageInfo

interface MessageInfo {
id: string;
chat: string; // JID of the chat
sender: string; // JID of the sender
isFromMe: boolean;
isGroup: boolean;
timestamp: number; // Unix timestamp
pushName: string; // Sender's display name
}

Presence Events

EventPayloadDescription
presence{ jid: string, presence: "available" | "unavailable", lastSeen?: number }Contact online/offline status.
chat_presence{ chat: string, sender: string, state: "composing" | "paused", media: "audio" | "" }Typing/recording indicator.

Group Events

EventPayloadDescription
group:infoGroupInfoEventGroup metadata changed.
group:joined{ jid: string, name: string }You joined a group.

GroupInfoEvent

interface GroupInfoEvent {
jid: string;
name?: string; // New group name
description?: string; // New description
announce?: boolean; // Announcement mode changed
locked?: boolean; // Lock status changed
ephemeral?: boolean; // Disappearing messages changed
join?: string[]; // JIDs that joined
leave?: string[]; // JIDs that left
promote?: string[]; // JIDs promoted to admin
demote?: string[]; // JIDs demoted from admin
}

Media Events

EventPayloadDescription
picture{ jid: string, remove: boolean, pictureId?: string }Profile/group picture changed.

Call Events

EventPayloadDescription
call:offer{ from: string, callId: string }Incoming call.
call:accept{ from: string, callId: string }Call accepted.
call:terminate{ from: string, callId: string, reason: string }Call ended.

Other Events

EventPayloadDescription
identity_change{ jid: string, timestamp: number }Contact's identity key changed (re-registered).
history_sync{ type: string }History sync progress.
qr{ code: string }QR code for pairing.
qr:timeoutnullQR pairing timed out.
qr:error{ event: string }QR channel error.
log{ level: string, msg: string, [key: string]: unknown }Go binary log output. Useful for debugging.
errorErrorInternal error.
exit{ code: number | null }Go binary exited.