Constructor
new Client(options)
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Client options Properties
|
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_interaction
- Client#event:message_revoke_me
- Client#event:message_revoke_everyone
- Client#event:message_ciphertext
- Client#event:message_pinned
- Client#event:message_edit
- Client#event:chat_state
- 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
Extends
- EventEmitter
Members
pupBrowser :puppeteer.Browser
Type:
- puppeteer.Browser
pupPage :puppeteer.Page
Type:
- puppeteer.Page
Methods
(async) _muteUnmuteChat(chatId, action, unmuteDateTs) → {Promise.<{isMuted: boolean, muteExpiration: number}>}
Internal method to mute or unmute the chat
Parameters:
| Name | Type | 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:
- Type
- Promise.<{isMuted: boolean, muteExpiration: number}>
(async) acceptChannelAdminInvite(channelId) → {Promise.<boolean>}
Accepts a channel admin invitation and promotes the current user to a channel admin
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The channel ID to accept the admin invitation from |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) acceptGroupV4Invite(inviteInfo) → {Promise.<Object>}
Accepts a private invitation to join a group
Parameters:
| Name | Type | Description |
|---|---|---|
inviteInfo |
object | Invite V4 Info |
Returns:
- Type
- Promise.<Object>
(async) acceptInvite(inviteCode) → {Promise.<string>}
Accepts an invitation to join a group
Parameters:
| Name | Type | Description |
|---|---|---|
inviteCode |
string | Invitation code |
Returns:
Id of the joined Chat
- Type
- Promise.<string>
(async) addOrEditCustomerNote(userId, note) → {Promise.<void>}
Add or edit a customer note
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string | The ID of a customer to add a note to |
note |
string | The note to add Customer notes are available only to eligible WhatsApp Business accounts. |
- Source:
- See:
Returns:
- Type
- Promise.<void>
(async) addOrRemoveLabels(labelIds, chatIds) → {Promise.<void>}
Change labels in chats
Parameters:
| Name | Type | Description |
|---|---|---|
labelIds |
Array.<(number|string)> | |
chatIds |
Array.<string> |
Returns:
- Type
- Promise.<void>
(async) approveGroupMembershipRequests(groupId, options) → {Promise.<Array.<MembershipRequestActionResult>>}
Approves membership requests if any
Parameters:
| Name | Type | Description |
|---|---|---|
groupId |
string | The group ID to get the membership request for |
options |
MembershipRequestActionOptions | Options for performing a membership request action |
Returns:
Returns 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
- Type
- Promise.<Array.<MembershipRequestActionResult>>
(async) archiveChat() → {boolean}
Enables and returns the archive state of the Chat
Returns:
- Type
- boolean
assertPublicEventGateHealthy()
Confirms that a native handoff still owns the unpublished event gate. RemoteAuth invokes this inside its final fenced promotion gate.
(async) attachEventListeners(expectedDocumentEpochopt)
Attach event listeners to WA Web Private function
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
expectedDocumentEpoch |
number |
<optional> |
document identity fence |
(async) cancelPairingCode()
Cancels an active pairing code session and returns to QR code mode
(async) createChannel(title, options) → {Promise.<(CreateChannelResult|string)>}
Creates a new channel
Parameters:
| Name | Type | Description |
|---|---|---|
title |
string | The channel name |
options |
CreateChannelOptions |
Returns:
Returns an object that handles the result for the channel creation or an error message as a string
- Type
- Promise.<(CreateChannelResult|string)>
(async) createGroup(title, participants, options) → {Promise.<(CreateGroupResult|string)>}
Creates a new group
Parameters:
| Name | Type | Description |
|---|---|---|
title |
string | Group title |
participants |
string | Contact | Array.<(Contact|string)> | 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 |
CreateGroupOptions | An object that handles options for group creation |
Returns:
Object with resulting data or an error message as a string
- Type
- Promise.<(CreateGroupResult|string)>
(async) deleteAddressbookContact(phoneNumber) → {Promise.<void>}
Deletes the contact from user's addressbook
Parameters:
| Name | Type | Description |
|---|---|---|
phoneNumber |
string | The contact's phone number in a format "17182222222", where "1" is a country code |
Returns:
- Type
- Promise.<void>
(async) deleteChannel(channelId) → {Promise.<boolean>}
Deletes the channel you created
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The ID of a channel to delete |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) deleteProfilePicture() → {Promise.<boolean>}
Deletes the current user's profile picture.
Returns:
Returns true if the picture was properly deleted.
- Type
- Promise.<boolean>
(async) demoteChannelAdmin(channelId, userId) → {Promise.<boolean>}
Demotes a channel admin to a regular subscriber (can be used also for self-demotion)
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The channel ID to demote an admin in |
userId |
string | The user ID to demote |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) destroy()
Closes the client
emit()
EventEmitter boundary used to hold every public WWebJS event emitted by a staging handoff. Internal browser/authentication callbacks continue to run, while consumers see nothing until durable promotion succeeds.
(async) getBlockedContacts() → {Promise.<Array.<Contact>>}
Gets all blocked contacts by host account
Returns:
- Type
- Promise.<Array.<Contact>>
(async) getBroadcastById(contactId) → {Promise.<Broadcast>}
Get broadcast instance by current user ID
Parameters:
| Name | Type | Description |
|---|---|---|
contactId |
string |
Returns:
- Type
- Promise.<Broadcast>
(async) getBroadcasts() → {Promise.<Array.<Broadcast>>}
Get all current Broadcast
Returns:
- Type
- Promise.<Array.<Broadcast>>
(async) getChannelByInviteCode(inviteCode) → {Promise.<Channel>}
Gets a Channel instance by invite code
Parameters:
| Name | Type | Description |
|---|---|---|
inviteCode |
string | The code that comes after the 'https://whatsapp.com/channel/' |
Returns:
- Type
- Promise.<Channel>
(async) getChannels() → {Promise.<Array.<Channel>>}
Gets all cached Channel instance
Returns:
- Type
- Promise.<Array.<Channel>>
(async) getChatById(chatId) → {Promise.<(Chat|Channel)>}
Gets chat or channel instance by ID
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string |
Returns:
(async) getChatLabels(chatId) → {Promise.<Array.<Label>>}
Get all Labels assigned to a chat
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string |
Returns:
- Type
- Promise.<Array.<Label>>
(async) getChats() → {Promise.<Array.<Chat>>}
Get all current chat instances
Returns:
- Type
- Promise.<Array.<Chat>>
(async) getChatsByLabelId(labelId) → {Promise.<Array.<Chat>>}
Get all Chats for a specific Label
Parameters:
| Name | Type | Description |
|---|---|---|
labelId |
string |
Returns:
- Type
- Promise.<Array.<Chat>>
(async) getCommonGroups(contactId) → {Promise.<Array.<WAWebJS.ChatId>>}
Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
Parameters:
| Name | Type | Description |
|---|---|---|
contactId |
string | the whatsapp user's ID (_serialized format) |
Returns:
- Type
- Promise.<Array.<WAWebJS.ChatId>>
(async) getCompanionIdentity() → {Promise.<{jid: string, companionFingerprint: string, fingerprintVersion: string, moduleAbi: string, webVersion: string}>}
Resolves the canonical companion identity without returning key material from the page realm.
Returns:
- Type
- Promise.<{jid: string, companionFingerprint: string, fingerprintVersion: string, moduleAbi: string, webVersion: string}>
getConnectionStatus() → {Readonly.<object>}
Returns an immutable provider-neutral connection snapshot without a browser or database round trip.
Returns:
- Type
- Readonly.<object>
(async) getContactById(contactId) → {Promise.<Contact>}
Get contact instance by ID
Parameters:
| Name | Type | Description |
|---|---|---|
contactId |
string |
Returns:
- Type
- Promise.<Contact>
(async) getContactDeviceCount(userId) → {Promise.<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"
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string |
Returns:
- Type
- Promise.<number>
(async) getContactLidAndPhone(userIds) → {Promise.<Array.<{lid: string, pn: string}>>}
Get lid and phone number for multiple users
Parameters:
| Name | Type | Description |
|---|---|---|
userIds |
Array.<string> | Array of user IDs |
Returns:
- Type
- Promise.<Array.<{lid: string, pn: string}>>
(async) getContacts() → {Promise.<Array.<Contact>>}
Get all current contact instances
Returns:
- Type
- Promise.<Array.<Contact>>
(async) getCountryCode(number) → {Promise.<string>}
Get the country code of a WhatsApp ID.
Parameters:
| Name | Type | Description |
|---|---|---|
number |
string | Number or ID |
Returns:
- Type
- Promise.<string>
(async) getCustomerNote(userId) → {Promise.<({chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}|null)>}
Get a customer note
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string | The ID of a customer to get a note from |
- Source:
- See:
Returns:
Null when customer notes are unavailable for the account.
- Type
- Promise.<({chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}|null)>
(async) getFormattedNumber(number) → {Promise.<string>}
Get the formatted number of a WhatsApp ID.
Parameters:
| Name | Type | Description |
|---|---|---|
number |
string | Number or ID |
Returns:
- Type
- Promise.<string>
(async) getGroupMembershipRequests(groupId) → {Promise.<Array.<GroupMembershipRequest>>}
Gets an array of membership requests
Parameters:
| Name | Type | Description |
|---|---|---|
groupId |
string | The ID of a group to get membership requests for |
Returns:
An array of membership requests
- Type
- Promise.<Array.<GroupMembershipRequest>>
(async) getInteractiveCapabilities()
Alias for Client#getInteractiveMessageCapabilities.
(async) getInteractiveMessageCapabilities() → {Promise.<object>}
Reports the interactive-message features exposed by the active WhatsApp Web runtime. This is a local capability probe; server-side eligibility is still established only by a real send/receive canary.
Returns:
- Type
- Promise.<object>
(async) getInviteInfo(inviteCode) → {Promise.<object>}
Returns an object with information about the invite code's group
Parameters:
| Name | Type | Description |
|---|---|---|
inviteCode |
string |
Returns:
Invite information
- Type
- Promise.<object>
(async) getLabelById(labelId) → {Promise.<Label>}
Get Label instance by ID
Parameters:
| Name | Type | Description |
|---|---|---|
labelId |
string |
Returns:
- Type
- Promise.<Label>
(async) getLabels() → {Promise.<Array.<Label>>}
Get all current Labels
Returns:
- Type
- Promise.<Array.<Label>>
(async) getMessageById(messageId) → {Promise.<Message>}
Get message by ID
Parameters:
| Name | Type | Description |
|---|---|---|
messageId |
string |
Returns:
- Type
- Promise.<Message>
(async) getNumberId(number) → {Promise.<(Object|null)>}
Get the registered WhatsApp ID for a number. Will return null if the number is not registered on WhatsApp.
Parameters:
| Name | Type | Description |
|---|---|---|
number |
string | Number or ID ("@c.us" will be automatically appended if not specified) |
Returns:
- Type
- Promise.<(Object|null)>
(async) getPinnedMessages(chatId) → {Promise.<Array.<Message>>}
Gets instances of all pinned messages in a chat
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string | The chat ID |
Returns:
- Type
- Promise.<Array.<Message>>
(async) getPollVotes(messageId) → {Promise.<Array.<PollVote>>}
Get Poll Votes
Parameters:
| Name | Type | Description |
|---|---|---|
messageId |
string |
Returns:
- Type
- Promise.<Array.<PollVote>>
(async) getProfilePicUrl(contactId) → {Promise.<string>}
Returns the contact ID's profile picture URL, if privacy settings allow it
Parameters:
| Name | Type | Description |
|---|---|---|
contactId |
string | the whatsapp user's ID |
Returns:
- Type
- Promise.<string>
(async) getState() → {WAState}
Gets the current connection state for the client
Returns:
- Type
- WAState
(async) getWWebVersion() → {Promise.<string>}
Returns the version of WhatsApp Web currently being run
Returns:
- Type
- Promise.<string>
(async) initialize()
Sets up events and requirements, kicks off authentication request
(async) inject()
Injection logic Private function
(async) isRegisteredUser(id) → {Promise.<Boolean>}
Check if a given ID is registered in whatsapp
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | the whatsapp user's ID |
Returns:
- Type
- Promise.<Boolean>
(async) logout()
Logs out the client, closing the current session
(async) markChatUnread(chatId)
Mark the Chat as unread
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string | ID of the chat that will be marked as unread |
(async) muteChat(chatId, unmuteDatenullable) → {Promise.<{isMuted: boolean, muteExpiration: number}>}
Mutes this chat forever, unless a date is specified
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
chatId |
string | ID of the chat that will be muted |
|
unmuteDate |
Date |
<nullable> |
Date when the chat will be unmuted, don't provide a value to mute forever |
Returns:
- Type
- Promise.<{isMuted: boolean, muteExpiration: number}>
(async) onWhatsApp(…phoneNumber) → {Promise.<Array.<{jid: (string|null), exists: boolean}>>}
Check whether numbers or IDs are registered on WhatsApp.
Accepted input formats (per item):
- Plain number as string:
5511999999999 - Plain number as number:
5511999999999 - Legacy user ID:
5511999999999@c.us - Canonical user JID:
5511999999999@s.whatsapp.net - LID:
227959751348297@lid
Call styles:
- Variadic:
client.onWhatsApp('5511999999999', '227959751348297@lid') - Array:
client.onWhatsApp(['5511999999999', '227959751348297@lid']) - Numeric value:
client.onWhatsApp(5511999999999)
Output order matches input order.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
phoneNumber |
string | number | Array.<(string|number)> |
<repeatable> |
Numbers or IDs to check |
Returns:
One item per input:
exists:trueif the account exists on WhatsApp.jid: preferred@s.whatsapp.netwhen available; otherwise resolved_serialized(@c.usor@lid);nullwhen not found or invalid input.
- Type
- Promise.<Array.<{jid: (string|null), exists: boolean}>>
(async) pinChat() → {Promise.<boolean>}
Pins the Chat
Returns:
New pin state. Could be false if the max number of pinned chats was reached.
- Type
- Promise.<boolean>
(async) refreshQR() → {Promise.<boolean>}
Refreshes the current QR code while the socket is still waiting for a scan. A refresh is deliberately deferred once pairing has started so the active companion handshake is never invalidated by an expiring QR timer.
Returns:
Whether a refresh was requested
- Type
- Promise.<boolean>
(async) rejectGroupMembershipRequests(groupId, options) → {Promise.<Array.<MembershipRequestActionResult>>}
Rejects membership requests if any
Parameters:
| Name | Type | Description |
|---|---|---|
groupId |
string | The group ID to get the membership request for |
options |
MembershipRequestActionOptions | Options for performing a membership request action |
Returns:
Returns 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
- Type
- Promise.<Array.<MembershipRequestActionResult>>
(async) requestPairingCode(phoneNumber, showNotificationopt, intervalMsopt) → {Promise.<string>}
Request authentication via pairing code instead of QR code
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
phoneNumber |
string | Phone number in international, symbol-free format (e.g. 12025550108 for US, 551155501234 for Brazil) |
||
showNotification |
boolean |
<optional> |
true | Show notification to pair on phone number |
intervalMs |
number |
<optional> |
180000 | The interval in milliseconds on how frequent to generate pairing code (WhatsApp default to 3 minutes) |
Returns:
- Returns a pairing code in format "ABCDEFGH"
- Type
- Promise.<string>
(async) resetState()
Force reset of connection state for the client
(async) revokeChannelAdminInvite(channelId, userId) → {Promise.<boolean>}
Revokes a channel admin invitation sent to a user by a channel owner
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The channel ID an invitation belongs to |
userId |
string | The user ID the invitation was sent to |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) revokeStatusMessage(messageId) → {Promise.<void>}
Revoke current own status messages
Parameters:
| Name | Type | Description |
|---|---|---|
messageId |
string |
Returns:
- Type
- Promise.<void>
(async) saveOrEditAddressbookContact(phoneNumber, firstName, lastName, syncToAddressbookopt) → {Promise.<void>}
Save new contact to user's addressbook or edit the existing one
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
phoneNumber |
string | The contact's phone number in a format "17182222222", where "1" is a country code |
||
firstName |
string | |||
lastName |
string | |||
syncToAddressbook |
boolean |
<optional> |
false | If set to true, the contact will also be saved to the user's address book on their phone. False by default |
Returns:
- Type
- Promise.<void>
(async) searchChannels(searchOptions) → {Promise.<Array.<Channel>>}
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 | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
searchOptions |
Object | Search options Properties
|
Returns:
Returns an array of Channel objects or an empty array if no channels were found
- Type
- Promise.<Array.<Channel>>
(async) searchMessages(query, optionsopt) → {Promise.<Array.<Message>>}
Searches for messages
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
query |
string | ||||||||||||||||||
options |
Object |
<optional> |
Properties
|
Returns:
- Type
- Promise.<Array.<Message>>
(async) sendChannelAdminInvite(chatId, channelId, options) → {Promise.<boolean>}
Sends a channel admin invitation to a user, allowing them to become an admin of the channel
Parameters:
| Name | Type | 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 |
SendChannelAdminInviteOptions |
Returns:
Returns true if an invitation was sent successfully, false otherwise
- Type
- Promise.<boolean>
(async) sendMessage(chatId, content, optionsopt) → {Promise.<(Message|null|undefined)>}
Send a message to a specific chatId
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
chatId |
string | ||
content |
string | MessageMedia | Location | Poll | Contact | Array.<Contact> | Buttons | List | InteractiveMessage | ||
options |
MessageSendOptions |
<optional> |
Options used when sending the message |
Returns:
Message that was just sent
- Type
- Promise.<(Message|null|undefined)>
(async) sendPresenceAvailable()
Marks the client as online
(async) sendPresenceUnavailable()
Marks the client as unavailable
(async) sendReaction(messageId, reaction) → {Promise}
Send an emoji reaction to a specific message
Parameters:
| Name | Type | Description |
|---|---|---|
messageId |
string | Id of the message to add the reaction. |
reaction |
string | Emoji to react with. Send an empty string to remove the reaction. |
Returns:
- Type
- Promise
(async) sendResponseToScheduledEvent(response, eventMessageId) → {Promise.<boolean>}
Sends a response to the scheduled event message, indicating whether a user is going to attend the event or not
Parameters:
| Name | Type | Description |
|---|---|---|
response |
number | The response code to the scheduled event message. Valid values are: |
eventMessageId |
string | The scheduled event message ID |
Returns:
- Type
- Promise.<boolean>
(async) sendSeen(chatId) → {Promise.<boolean>}
Mark as seen for the Chat
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string |
Returns:
result
- Type
- Promise.<boolean>
(async) setAutoDownloadAudio(flag)
Setting autoload download audio
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | true/false |
(async) setAutoDownloadDocuments(flag)
Setting autoload download documents
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | true/false |
(async) setAutoDownloadPhotos(flag)
Setting autoload download photos
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | true/false |
(async) setAutoDownloadVideos(flag)
Setting autoload download videos
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | true/false |
(async) setBackgroundSync(flag) → {Promise.<boolean>}
Setting background synchronization. NOTE: this action will take effect after you restart the client.
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | true/false |
Returns:
- Type
- Promise.<boolean>
(async) setDisplayName(displayName) → {Promise.<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.
Parameters:
| Name | Type | Description |
|---|---|---|
displayName |
string | New display name |
Returns:
- Type
- Promise.<Boolean>
(async) setProfilePicture(media) → {Promise.<boolean>}
Sets the current user's profile picture.
Parameters:
| Name | Type | Description |
|---|---|---|
media |
MessageMedia |
Returns:
Returns true if the picture was properly updated.
- Type
- Promise.<boolean>
(async) setStatus(status)
Sets the current user's status message
Parameters:
| Name | Type | Description |
|---|---|---|
status |
string | New status message |
(async) subscribeToChannel(channelId) → {Promise.<boolean>}
Subscribe to channel
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The channel ID |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) syncHistory(chatId) → {Promise.<boolean>}
Sync chat history conversation
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string |
Returns:
True if operation completed successfully, false otherwise.
- Type
- Promise.<boolean>
(async) transferChannelOwnership(channelId, newOwnerId, options) → {Promise.<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 | Description |
|---|---|---|
channelId |
string | |
newOwnerId |
string | |
options |
TransferChannelOwnershipOptions |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) unarchiveChat() → {boolean}
Changes and returns the archive state of the Chat
Returns:
- Type
- boolean
(async) unmuteChat(chatId) → {Promise.<{isMuted: boolean, muteExpiration: number}>}
Unmutes the Chat
Parameters:
| Name | Type | Description |
|---|---|---|
chatId |
string | ID of the chat that will be unmuted |
Returns:
- Type
- Promise.<{isMuted: boolean, muteExpiration: number}>
(async) unpinChat() → {Promise.<boolean>}
Unpins the Chat
Returns:
New pin state
- Type
- Promise.<boolean>
(async) unsubscribeFromChannel(channelId, options) → {Promise.<boolean>}
Unsubscribe from channel
Parameters:
| Name | Type | Description |
|---|---|---|
channelId |
string | The channel ID |
options |
UnsubscribeOptions |
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
Events
auth_failure
Emitted when there has been an error while trying to restore an existing session
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string |
change_battery
Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
batteryInfo |
object |
Properties
|
change_state
Emitted when the connection state changes
Parameters:
| Name | Type | Description |
|---|---|---|
state |
WAState | the new connection state |
chat_archived
Emitted when a chat is archived/unarchived
Parameters:
| Name | Type | Description |
|---|---|---|
chat |
Chat | |
currState |
boolean | |
prevState |
boolean |
chat_removed
Emitted when a chat is removed
Parameters:
| Name | Type | Description |
|---|---|---|
chat |
Chat |
chat_state
Emitted when a chat state changes
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
chatState |
object |
Properties
|
contact_changed
Emitted when a contact or a group participant changes their phone number.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
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
Parameters:
| Name | Type | Description |
|---|---|---|
reason |
WAState | "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.
Parameters:
| Name | Type | Description |
|---|---|---|
notification |
GroupNotification | 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.
Parameters:
| Name | Type | Description |
|---|---|---|
notification |
GroupNotification | GroupNotification with more information about the action |
group_leave
Emitted when a user leaves the chat or is removed by an admin.
Parameters:
| Name | Type | Description |
|---|---|---|
notification |
GroupNotification | 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 | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
notification |
GroupNotification | GroupNotification with more information about the action Properties
|
group_update
Emitted when group settings are updated, such as subject, description or picture.
Parameters:
| Name | Type | Description |
|---|---|---|
notification |
GroupNotification | GroupNotification with more information about the action |
media_uploaded
Emitted when media has been uploaded for a message sent by the client.
Modern WhatsApp Web builds no longer consistently transition
isUnsentMedia; the first server ACK is an authoritative fallback
because it is impossible before the encrypted upload is accepted.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The message with media that was uploaded |
message
Emitted when a new message is received.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The message that was received |
message_ack
Emitted when an ack event occurrs on message type.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The message that was affected |
ack |
MessageAck | The new ACK value |
message_ciphertext
Emitted when a message is received as ciphertext (not yet decrypted)
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message |
message_ciphertext_failed
Emitted when a ciphertext message failed to decrypt after recovery attempt
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message |
message_create
Emitted when a new message is created, which may include the current user's own messages.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The message that was created |
message_edit
Emitted when messages are edited
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | |
newBody |
string | |
prevBody |
string |
message_interaction
Emitted for a bounded button, list, template-button or
native-flow response. Display text and IDs are untrusted;
correlated is true only when they match a recent
message sent by this Client instance.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The response message |
interaction |
Object | Normalized response metadata |
message_pinned
Emitted when a message pin/unpin action is created.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
message |
Message | The message that contains the pin action |
||||||||||||||||||||||||||||||||
pinData |
Object |
Properties
|
message_reaction
Emitted when a reaction is sent, received, updated or removed
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
reaction |
object |
Properties
|
message_revoke_everyone
Emitted when a message is deleted for everyone in the chat.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
message |
Message | The message that was revoked, in its current state. It will not contain the original message's data. |
|
revoked_msg |
Message |
<nullable> |
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. |
message_revoke_me
Emitted when a message is deleted by the current user.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message | The message that was revoked |
qr
Emitted when a QR code is received
Parameters:
| Name | Type | Description |
|---|---|---|
qr |
string | QR Code |
vote_update
Emitted when some poll option is selected or deselected, shows a user's current selected option(s) on the poll