Documentation Index
Fetch the complete documentation index at: https://zapo.to/llms.txt
Use this file to discover all available pages before exploring further.
Own presence
Broadcast whether the account is online with client.presence.send:
await client.presence.send('available') // appears online
await client.presence.send('unavailable') // appears offline
Typing indicators (chat-state)
sendChatstate sends a per-chat hint such as typing or recording:
// "typing…"
await client.presence.sendChatstate(jid, { state: 'composing' })
// "recording audio…"
await client.presence.sendChatstate(jid, { state: 'recording' })
// clear the indicator
await client.presence.sendChatstate(jid, { state: 'paused' })
A common pattern is to show typing briefly before replying:
await client.presence.sendChatstate(jid, { state: 'composing' })
await new Promise((r) => setTimeout(r, 1200))
await client.message.send(jid, 'Done thinking!')
await client.presence.sendChatstate(jid, { state: 'paused' })
To receive a contact’s presence and chat-state, subscribe to them:
await client.presence.subscribe(jid)
client.on('presence', (event) => {
console.log(event.type, event.lastSeen)
})
client.on('chatstate', (event) => {
console.log(event.state, 'from', event.participantJid)
})
Subscriptions are per-JID and live only for the current connection. After a reconnect you must re-subscribe to keep receiving updates.
Status broadcasts
Post a status (the “stories” feature) with client.status (WaStatusCoordinator). The content is the same content union as a normal message; you provide the recipient list:
const result = await client.status.send({
content: 'Hello from my status!',
recipients: ['5511999999999@s.whatsapp.net', '5511888888888@s.whatsapp.net']
})
Media works too:
await client.status.send({
content: { type: 'image', media: './story.jpg', mimetype: 'image/jpeg' },
recipients
})
Status privacy & mute
// Who can see your status
await client.status.setPrivacy({ /* WaSetStatusPrivacyInput */ })
// Mute a contact's status
await client.status.setUserMuted(jid, true)
// Revoke a status you posted
await client.status.revokeStatus({ messageId, recipients })