Client
Source: Client.
Starting point for interacting with the WhatsApp Web API
Properties
Methods
- _muteUnmuteChat(chatId, action, unmuteDateTs)
- acceptChannelAdminInvite(channelId)
- acceptGroupV4Invite(inviteInfo)
- acceptInvite(inviteCode)
- addOrEditCustomerNote(userId, note)
- addOrRemoveLabels(labelIds, chatIds)
- approveGroupMembershipRequests(groupId, options)
- archiveChat()
- attachEventListeners()
- createCallLink(startTime, callType)
- createChannel(title, options)
- createGroup(title, participants, options)
- deleteAddressbookContact(phoneNumber)
- deleteChannel(channelId)
- deleteProfilePicture()
- demoteChannelAdmin(channelId, userId)
- destroy()
- getBlockedContacts()
- getBroadcasts()
- getChannelByInviteCode(inviteCode)
- getChannels()
- getChatById(chatId)
- getChatLabels(chatId)
- getChats()
- getChatsByLabelId(labelId)
- getCommonGroups(contactId)
- getContactById(contactId)
- getContactDeviceCount(userId)
- getContactLidAndPhone(userIds)
- getContacts()
- getCountryCode(number)
- getCustomerNote(userId)
- getFormattedNumber(number)
- getGroupMembershipRequests(groupId)
- getInviteInfo(inviteCode)
- getLabelById(labelId)
- getLabels()
- getNumberId(number)
- getPinnedMessages(chatId)
- getPollVotes(messageId)
- getProfilePicUrl(contactId)
- getState()
- getWWebVersion()
- initialize()
- inject()
- isRegisteredUser(id)
- logout()
- markChatUnread(chatId)
- muteChat(chatId, unmuteDate)
- pinChat()
- rejectGroupMembershipRequests(groupId, options)
- requestPairingCode(phoneNumber[, showNotification][, intervalMs])
- resetState()
- revokeChannelAdminInvite(channelId, userId)
- saveOrEditAddressbookContact(phoneNumber, firstName, lastName[, syncToAddressbook])
- searchChannels(searchOptions)
- searchMessages(query[, options])
- sendChannelAdminInvite(chatId, channelId, options)
- sendMessage(chatId, content[, options])
- sendPresenceAvailable()
- sendPresenceUnavailable()
- sendResponseToScheduledEvent(response, eventMessageId)
- sendSeen(chatId)
- setAutoDownloadAudio(flag)
- setAutoDownloadDocuments(flag)
- setAutoDownloadPhotos(flag)
- setAutoDownloadVideos(flag)
- setBackgroundSync(flag)
- setDisplayName(displayName)
- setProfilePicture(media)
- setStatus(status)
- subscribeToChannel(channelId)
- syncHistory(chatId)
- transferChannelOwnership(channelId, newOwnerId, options)
- unarchiveChat()
- unmuteChat(chatId)
- unpinChat()
- unsubscribeFromChannel(channelId, options)
Events
new Client(options)
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
|
|
Client options Values in
|
- Extends
- EventEmitter
- Fires
- Client#event:qr
- Client#event:authenticated
- Client#event:auth_failure
- Client#event:ready
- Client#event:message
- Client#event:message_ack
- Client#event:message_create
- Client#event:message_revoke_me
- Client#event:message_revoke_everyone
- Client#event:message_ciphertext
- Client#event:message_edit
- Client#event:media_uploaded
- Client#event:group_join
- Client#event:group_leave
- Client#event:group_update
- Client#event:disconnected
- Client#event:change_state
- Client#event:contact_changed
- Client#event:group_admin_changed
- Client#event:group_membership_request
- Client#event:vote_update
Properties
info ClientInfo
Current connection information
pupBrowser puppeteer.Browser
pupPage puppeteer.Page
Methods
_muteUnmuteChat(chatId, action, unmuteDateTs) → Promise containing {isMuted: boolean, muteExpiration: number}
Internal method to mute or unmute the chat
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be muted/unmuted |
|
action |
string |
|
The action: 'MUTE' or 'UNMUTE' |
|
unmuteDateTs |
number |
|
Timestamp at which the chat will be unmuted |
- Returns
Promise containing {isMuted: boolean, muteExpiration: number}
acceptChannelAdminInvite(channelId) → Promise containing boolean
Accepts a channel admin invitation and promotes the current user to a channel admin
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID to accept the admin invitation from |
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
acceptGroupV4Invite(inviteInfo) → Promise containing Object
Accepts a private invitation to join a group
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteInfo |
object |
|
Invite V4 Info |
- Returns
Promise containing Object
acceptInvite(inviteCode) → Promise containing string
Accepts an invitation to join a group
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
Invitation code |
- Returns
Promise containing stringId of the joined Chat
addOrEditCustomerNote(userId, note) → Promise containing void
Add or edit a customer note
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
The ID of a customer to add a note to |
|
note |
string |
|
The note to add |
- See also
- https://faq.whatsapp.com/1433099287594476
- Returns
Promise containing void
addOrRemoveLabels(labelIds, chatIds) → Promise containing void
Change labels in chats
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelIds |
Array of (number or string) |
|
|
|
chatIds |
Array of string |
|
- Returns
Promise containing void
approveGroupMembershipRequests(groupId, options) → Promise containing Array of MembershipRequestActionResult
Approves membership requests if any
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The group ID to get the membership request for |
|
options |
|
Options for performing a membership request action |
- Returns
Promise containing Array of MembershipRequestActionResultReturns an array of requester IDs whose membership requests were approved and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
archiveChat() → boolean
Enables and returns the archive state of the Chat
- Returns
boolean
attachEventListeners()
Attach event listeners to WA Web Private function
Property
| Name | Type | Optional | Description |
|---|---|---|---|
|
reinject |
boolean |
|
is this a reinject? |
createCallLink(startTime, callType) → Promise containing string
Generates a WhatsApp call link (video call or voice call)
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
startTime |
Date |
|
The start time of the call |
|
callType |
string |
|
The type of a WhatsApp call link to generate, valid values are: |
- Returns
Promise containing stringThe WhatsApp call link (https://call.whatsapp.com/video/XxXxXxXxXxXxXx) or an empty string if a generation failed.
createChannel(title, options) → Promise containing (CreateChannelResult or string)
Creates a new channel
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
title |
string |
|
The channel name |
|
options |
|
- Returns
Promise containing (CreateChannelResult or string)Returns an object that handles the result for the channel creation or an error message as a string
createGroup(title, participants, options) → Promise containing (CreateGroupResult or string)
Creates a new group
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
title |
string |
|
Group title |
|
participants |
(string, Contact, Array of (Contact or string), or undefined) |
|
A single Contact object or an ID as a string or an array of Contact objects or contact IDs to add to the group |
|
options |
|
An object that handles options for group creation |
- Returns
Promise containing (CreateGroupResult or string)Object with resulting data or an error message as a string
deleteAddressbookContact(phoneNumber) → Promise containing void
Deletes the contact from user's addressbook
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
phoneNumber |
string |
|
The contact's phone number in a format "17182222222", where "1" is a country code |
- Returns
Promise containing void
deleteChannel(channelId) → Promise containing boolean
Deletes the channel you created
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The ID of a channel to delete |
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
deleteProfilePicture() → Promise containing boolean
Deletes the current user's profile picture.
- Returns
Promise containing booleanReturns true if the picture was properly deleted.
demoteChannelAdmin(channelId, userId) → Promise containing boolean
Demotes a channel admin to a regular subscriber (can be used also for self-demotion)
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID to demote an admin in |
|
userId |
string |
|
The user ID to demote |
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
destroy()
Closes the client
getBlockedContacts() → Promise containing Array of Contact
Gets all blocked contacts by host account
- Returns
Promise containing Array of Contact
getBroadcasts() → Promise containing Array of Broadcast
Get all current Broadcast
- Returns
Promise containing Array of Broadcast
getChannelByInviteCode(inviteCode) → Promise containing Channel
Gets a Channel instance by invite code
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
The code that comes after the 'https://whatsapp.com/channel/' |
- Returns
Promise containing Channel
getChannels() → Promise containing Array of Channel
Gets all cached Channel instance
- Returns
Promise containing Array of Channel
getChatById(chatId) → Promise containing (Chat or Channel)
Gets chat or channel instance by ID
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
getChatLabels(chatId) → Promise containing Array of Label
Get all Labels assigned to a chat
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
- Returns
Promise containing Array of Label
getChats() → Promise containing Array of Chat
Get all current chat instances
- Returns
Promise containing Array of Chat
getChatsByLabelId(labelId) → Promise containing Array of Chat
Get all Chats for a specific Label
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelId |
string |
|
- Returns
Promise containing Array of Chat
getCommonGroups(contactId) → Promise containing Array of WAWebJS.ChatId
Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
the whatsapp user's ID (_serialized format) |
- Returns
Promise containing Array of WAWebJS.ChatId
getContactById(contactId) → Promise containing Contact
Get contact instance by ID
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
- Returns
Promise containing Contact
getContactDeviceCount(userId) → Promise containing number
Get user device count by ID Each WaWeb Connection counts as one device, and the phone (if exists) counts as one So for a non-enterprise user with one WaWeb connection it should return "2"
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
- Returns
Promise containing number
getContactLidAndPhone(userIds) → Promise containing Array of {lid: string, pn: string}
Get lid and phone number for multiple users
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
userIds |
Array of string |
|
Array of user IDs |
- Returns
Promise containing Array of {lid: string, pn: string}
getContacts() → Promise containing Array of Contact
Get all current contact instances
- Returns
Promise containing Array of Contact
getCountryCode(number) → Promise containing string
Get the country code of a WhatsApp ID.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID |
- Returns
Promise containing string
getCustomerNote(userId) → Promise containing {chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}
Get a customer note
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
The ID of a customer to get a note from |
- See also
- https://faq.whatsapp.com/1433099287594476
- Returns
Promise containing {chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}
getFormattedNumber(number) → Promise containing string
Get the formatted number of a WhatsApp ID.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID |
- Returns
Promise containing string
getGroupMembershipRequests(groupId) → Promise containing Array of GroupMembershipRequest
Gets an array of membership requests
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The ID of a group to get membership requests for |
- Returns
Promise containing Array of GroupMembershipRequestAn array of membership requests
getInviteInfo(inviteCode) → Promise containing object
Returns an object with information about the invite code's group
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
- Returns
Promise containing objectInvite information
getLabelById(labelId) → Promise containing Label
Get Label instance by ID
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelId |
string |
|
- Returns
Promise containing Label
getLabels() → Promise containing Array of Label
Get all current Labels
- Returns
Promise containing Array of Label
getNumberId(number) → Promise containing (Object or null)
Get the registered WhatsApp ID for a number. Will return null if the number is not registered on WhatsApp.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID ("@c.us" will be automatically appended if not specified) |
- Returns
Promise containing (Object or null)
getPinnedMessages(chatId)
Gets instances of all pinned messages in a chat
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
The chat ID |
- Returns
getPollVotes(messageId) → Promise containing Array of PollVote
Get Poll Votes
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
messageId |
string |
|
- Returns
Promise containing Array of PollVote
getProfilePicUrl(contactId) → Promise containing string
Returns the contact ID's profile picture URL, if privacy settings allow it
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
the whatsapp user's ID |
- Returns
Promise containing string
getState() → WAState
Gets the current connection state for the client
- Returns
getWWebVersion() → Promise containing string
Returns the version of WhatsApp Web currently being run
- Returns
Promise containing string
initialize()
Sets up events and requirements, kicks off authentication request
inject()
Injection logic Private function
isRegisteredUser(id) → Promise containing Boolean
Check if a given ID is registered in whatsapp
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
string |
|
the whatsapp user's ID |
- Returns
Promise containing Boolean
logout()
Logs out the client, closing the current session
markChatUnread(chatId)
Mark the Chat as unread
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be marked as unread |
muteChat(chatId, unmuteDate) → Promise containing {isMuted: boolean, muteExpiration: number}
Mutes this chat forever, unless a date is specified
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be muted |
|
unmuteDate |
Date |
|
Date when the chat will be unmuted, don't provide a value to mute forever Value can be null. |
- Returns
Promise containing {isMuted: boolean, muteExpiration: number}
pinChat() → Promise containing boolean
Pins the Chat
- Returns
Promise containing booleanNew pin state. Could be false if the max number of pinned chats was reached.
rejectGroupMembershipRequests(groupId, options) → Promise containing Array of MembershipRequestActionResult
Rejects membership requests if any
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The group ID to get the membership request for |
|
options |
|
Options for performing a membership request action |
- Returns
Promise containing Array of MembershipRequestActionResultReturns an array of requester IDs whose membership requests were rejected and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
requestPairingCode(phoneNumber[, showNotification][, intervalMs]) → Promise containing string
Request authentication via pairing code instead of QR code
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
phoneNumber |
string |
|
Phone number in international, symbol-free format (e.g. 12025550108 for US, 551155501234 for Brazil) |
|
showNotification |
boolean |
Yes |
Show notification to pair on phone number Defaults to |
|
intervalMs |
number |
Yes |
The interval in milliseconds on how frequent to generate pairing code (WhatsApp default to 3 minutes) Defaults to |
- Returns
Promise containing string- Returns a pairing code in format "ABCDEFGH"
resetState()
Force reset of connection state for the client
revokeChannelAdminInvite(channelId, userId) → Promise containing boolean
Revokes a channel admin invitation sent to a user by a channel owner
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID an invitation belongs to |
|
userId |
string |
|
The user ID the invitation was sent to |
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
saveOrEditAddressbookContact(phoneNumber, firstName, lastName[, syncToAddressbook]) → Promise containing void
Save new contact to user's addressbook or edit the existing one
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
phoneNumber |
string |
|
The contact's phone number in a format "17182222222", where "1" is a country code |
|
firstName |
string |
|
|
|
lastName |
string |
|
|
|
syncToAddressbook |
boolean |
Yes |
If set to true, the contact will also be saved to the user's address book on their phone. False by default Defaults to |
- Returns
Promise containing void
searchChannels(searchOptions)
Searches for channels based on search criteria, there are some notes:
- The method finds only channels you are not subscribed to currently
- If you have never been subscribed to a found channel
or you have unsubscribed from it with
UnsubscribeOptions.deleteLocalModelsset to 'true', the lastMessage property of a found channel will be 'null'
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
searchOptions |
Object |
|
Search options Values in
|
- Returns
searchMessages(query[, options]) → Promise containing Array of Message
Searches for messages
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
query |
string |
|
|||||||||||||||||
|
options |
Object |
Yes |
Values in
|
- Returns
Promise containing Array of Message
sendChannelAdminInvite(chatId, channelId, options) → Promise containing boolean
Sends a channel admin invitation to a user, allowing them to become an admin of the channel
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
The ID of a user to send the channel admin invitation to |
|
channelId |
string |
|
The ID of a channel for which the invitation is being sent |
|
options |
|
- Returns
Promise containing booleanReturns true if an invitation was sent successfully, false otherwise
sendMessage(chatId, content[, options]) → Promise containing Message
Send a message to a specific chatId
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
|
|
content |
(string, MessageMedia, Location, Poll, Contact, Array of Contact, Buttons, or List) |
|
|
|
options |
Yes |
Options used when sending the message |
- Returns
Promise containing MessageMessage that was just sent
sendPresenceAvailable()
Marks the client as online
sendPresenceUnavailable()
Marks the client as unavailable
sendResponseToScheduledEvent(response, eventMessageId) → Promise containing boolean
Sends a response to the scheduled event message, indicating whether a user is going to attend the event or not
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
response |
number |
|
The response code to the scheduled event message. Valid values are: |
|
eventMessageId |
string |
|
The scheduled event message ID |
- Returns
Promise containing boolean
sendSeen(chatId) → Promise containing boolean
Mark as seen for the Chat
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
- Returns
Promise containing booleanresult
setAutoDownloadAudio(flag)
Setting autoload download audio
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
setAutoDownloadDocuments(flag)
Setting autoload download documents
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
setAutoDownloadPhotos(flag)
Setting autoload download photos
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
setAutoDownloadVideos(flag)
Setting autoload download videos
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
setBackgroundSync(flag) → Promise containing boolean
Setting background synchronization. NOTE: this action will take effect after you restart the client.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
- Returns
Promise containing boolean
setDisplayName(displayName) → Promise containing Boolean
Sets the current user's display name. This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
displayName |
string |
|
New display name |
- Returns
Promise containing Boolean
setProfilePicture(media) → Promise containing boolean
Sets the current user's profile picture.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
media |
|
- Returns
Promise containing booleanReturns true if the picture was properly updated.
setStatus(status)
Sets the current user's status message
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
status |
string |
|
New status message |
subscribeToChannel(channelId) → Promise containing boolean
Subscribe to channel
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID |
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
syncHistory(chatId) → Promise containing boolean
Sync chat history conversation
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
- Returns
Promise containing booleanTrue if operation completed successfully, false otherwise.
transferChannelOwnership(channelId, newOwnerId, options) → Promise containing boolean
Transfers a channel ownership to another user. Note: the user you are transferring the channel ownership to must be a channel admin.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
|
|
newOwnerId |
string |
|
|
|
options |
|
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
unarchiveChat() → boolean
Changes and returns the archive state of the Chat
- Returns
boolean
unmuteChat(chatId) → Promise containing {isMuted: boolean, muteExpiration: number}
Unmutes the Chat
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be unmuted |
- Returns
Promise containing {isMuted: boolean, muteExpiration: number}
unpinChat() → Promise containing boolean
Unpins the Chat
- Returns
Promise containing booleanNew pin state
unsubscribeFromChannel(channelId, options) → Promise containing boolean
Unsubscribe from channel
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID |
|
options |
|
- Returns
Promise containing booleanReturns true if the operation completed successfully, false otherwise
Events
auth_failure
Emitted when there has been an error while trying to restore an existing session
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
string |
|
authenticated
Emitted when authentication is successful
change_battery
Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
batteryInfo |
object |
|
Values in
|
- Deprecated
change_state
Emitted when the connection state changes
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
state |
|
the new connection state |
chat_archived
Emitted when a chat is archived/unarchived
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
chat |
|
||
|
currState |
boolean |
|
|
|
prevState |
boolean |
|
chat_removed
Emitted when a chat is removed
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
chat |
|
code
Emitted when a pairing code is received
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
code |
string |
|
Code |
- Returns
stringCode that was just received
contact_changed
Emitted when a contact or a group participant changes their phone number.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
Message with more information about the event. |
|
|
oldId |
String |
|
The user's id (an old one) who changed their phone number and who triggered the notification. |
|
newId |
String |
|
The user's new id after the change. |
|
isContact |
Boolean |
|
Indicates if a contact or a group participant changed their phone number. |
disconnected
Emitted when the client has been disconnected
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
reason |
(WAState or "LOGOUT") |
|
reason that caused the disconnect |
group_admin_changed
Emitted when a current user is promoted to an admin or demoted to a regular user.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
group_join
Emitted when a user joins the chat via invite link or is added by an admin.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
group_leave
Emitted when a user leaves the chat or is removed by an admin.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
group_membership_request
Emitted when some user requested to join the group that has the membership approval mode turned on
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action Values in
|
group_update
Emitted when group settings are updated, such as subject, description or picture.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
incoming_call
Emitted when a call is received
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
call |
object |
|
Values in
|
media_uploaded
Emitted when media has been uploaded for a message sent by the client.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message with media that was uploaded |
message
Emitted when a new message is received.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was received |
message_ack
Emitted when an ack event occurrs on message type.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was affected |
|
|
ack |
|
The new ACK value |
message_ciphertext
Emitted when messages are edited
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
message_create
Emitted when a new message is created, which may include the current user's own messages.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was created |
message_edit
Emitted when messages are edited
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
||
|
newBody |
string |
|
|
|
prevBody |
string |
|
message_reaction
Emitted when a reaction is sent, received, updated or removed
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
reaction |
object |
|
Values in
|
message_revoke_everyone
Emitted when a message is deleted for everyone in the chat.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was revoked, in its current state. It will not contain the original message's data. |
|
|
revoked_msg |
|
The message that was revoked, before it was revoked. It will contain the message's original data. Note that due to the way this data is captured, it may be possible that this param will be undefined. Value can be null. |
message_revoke_me
Emitted when a message is deleted by the current user.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was revoked |
qr
Emitted when a QR code is received
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
qr |
string |
|
QR Code |
ready
Emitted when the client has initialized and is ready to receive messages.
vote_update
Emitted when some poll option is selected or deselected, shows a user's current selected option(s) on the poll