Source: Client.
Starting point for interacting with the WhatsApp Web API
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
|
|
Client options Values in
|
Current connection information
Internal method to mute or unmute the chat
| 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 |
Promise containing {isMuted: boolean, muteExpiration: number}
Accepts a channel admin invitation and promotes the current user to a channel admin
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID to accept the admin invitation from |
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Accepts a private invitation to join a group
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteInfo |
object |
|
Invite V4 Info |
Promise containing Object
Accepts an invitation to join a group
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
Invitation code |
Promise containing string
Id of the joined Chat
Add or edit a customer note
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
The ID of a customer to add a note to |
|
note |
string |
|
The note to add |
Promise containing void
Change labels in chats
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelIds |
Array of (number or string) |
|
|
|
chatIds |
Array of string |
|
Promise containing void
Approves membership requests if any
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The group ID to get the membership request for |
|
options |
|
Options for performing a membership request action |
Promise containing Array of MembershipRequestActionResult
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
Enables and returns the archive state of the Chat
boolean
Attach event listeners to WA Web Private function
| Name | Type | Optional | Description |
|---|---|---|---|
|
reinject |
boolean |
|
is this a reinject? |
Cancels an active pairing code session and returns to QR code mode
Generates a WhatsApp call link (video call or voice call)
| 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: |
Promise containing string
The WhatsApp call link (https://call.whatsapp.com/video/XxXxXxXxXxXxXx) or an empty string if a generation failed.
Creates a new channel
| Name | Type | Optional | Description |
|---|---|---|---|
|
title |
string |
|
The channel name |
|
options |
|
Promise containing (CreateChannelResult or string)
Returns an object that handles the result for the channel creation or an error message as a string
Creates a new group
| 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 |
Promise containing (CreateGroupResult or string)
Object with resulting data or an error message as a string
Deletes the contact from user's addressbook
| Name | Type | Optional | Description |
|---|---|---|---|
|
phoneNumber |
string |
|
The contact's phone number in a format "17182222222", where "1" is a country code |
Promise containing void
Deletes the channel you created
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The ID of a channel to delete |
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Deletes the current user's profile picture.
Promise containing boolean
Returns true if the picture was properly deleted.
Demotes a channel admin to a regular subscriber (can be used also for self-demotion)
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID to demote an admin in |
|
userId |
string |
|
The user ID to demote |
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Closes the client
Gets all blocked contacts by host account
Promise containing Array of Contact
Get broadcast instance by current user ID
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
Promise containing Broadcast
Get all current Broadcast
Promise containing Array of Broadcast
Gets a Channel instance by invite code
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
The code that comes after the 'https://whatsapp.com/channel/' |
Promise containing Channel
Gets all cached Channel instance
Promise containing Array of Channel
Gets chat or channel instance by ID
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
Get all Labels assigned to a chat
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
Promise containing Array of Label
Get all current chat instances
Promise containing Array of Chat
Get all Chats for a specific Label
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelId |
string |
|
Promise containing Array of Chat
Gets the Contact's common groups with you. Returns empty array if you don't have any common group.
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
the whatsapp user's ID (_serialized format) |
Promise containing Array of WAWebJS.ChatId
Get contact instance by ID
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
Promise containing Contact
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"
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
Promise containing number
Get lid and phone number for multiple users
| Name | Type | Optional | Description |
|---|---|---|---|
|
userIds |
Array of string |
|
Array of user IDs |
Promise containing Array of {lid: string, pn: string}
Get all current contact instances
Promise containing Array of Contact
Get the country code of a WhatsApp ID.
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID |
Promise containing string
Get a customer note
| Name | Type | Optional | Description |
|---|---|---|---|
|
userId |
string |
|
The ID of a customer to get a note from |
Promise containing {chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}
Get the formatted number of a WhatsApp ID.
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID |
Promise containing string
Gets an array of membership requests
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The ID of a group to get membership requests for |
Promise containing Array of GroupMembershipRequest
An array of membership requests
Returns an object with information about the invite code's group
| Name | Type | Optional | Description |
|---|---|---|---|
|
inviteCode |
string |
|
Promise containing object
Invite information
Get Label instance by ID
| Name | Type | Optional | Description |
|---|---|---|---|
|
labelId |
string |
|
Promise containing Label
Get all current Labels
Promise containing Array of Label
Get message by ID
| Name | Type | Optional | Description |
|---|---|---|---|
|
messageId |
string |
|
Promise containing Message
Get the registered WhatsApp ID for a number. Will return null if the number is not registered on WhatsApp.
| Name | Type | Optional | Description |
|---|---|---|---|
|
number |
string |
|
Number or ID ("@c.us" will be automatically appended if not specified) |
Promise containing (Object or null)
Gets instances of all pinned messages in a chat
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
The chat ID |
Promise containing Array of Message
Get Poll Votes
| Name | Type | Optional | Description |
|---|---|---|---|
|
messageId |
string |
|
Promise containing Array of PollVote
Returns the contact ID's profile picture URL, if privacy settings allow it
| Name | Type | Optional | Description |
|---|---|---|---|
|
contactId |
string |
|
the whatsapp user's ID |
Promise containing string
Gets the current connection state for the client
Returns the version of WhatsApp Web currently being run
Promise containing string
Sets up events and requirements, kicks off authentication request
Injection logic Private function
Check if a given ID is registered in whatsapp
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
string |
|
the whatsapp user's ID |
Promise containing Boolean
Logs out the client, closing the current session
Mark the Chat as unread
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be marked as unread |
Mutes this chat forever, unless a date is specified
| 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. |
Promise containing {isMuted: boolean, muteExpiration: number}
Pins the Chat
Promise containing boolean
New pin state. Could be false if the max number of pinned chats was reached.
Rejects membership requests if any
| Name | Type | Optional | Description |
|---|---|---|---|
|
groupId |
string |
|
The group ID to get the membership request for |
|
options |
|
Options for performing a membership request action |
Promise containing Array of MembershipRequestActionResult
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
Request authentication via pairing code instead of QR code
| 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 |
Promise containing string
Force reset of connection state for the client
Revokes a channel admin invitation sent to a user by a channel owner
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID an invitation belongs to |
|
userId |
string |
|
The user ID the invitation was sent to |
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Revoke current own status messages
| Name | Type | Optional | Description |
|---|---|---|---|
|
messageId |
string |
|
Promise containing void
Save new contact to user's addressbook or edit the existing one
| 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 |
Promise containing void
Searches for channels based on search criteria, there are some notes:
UnsubscribeOptions.deleteLocalModels set to 'true',
the lastMessage property of a found channel will be 'null'| Name | Type | Optional | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
searchOptions |
Object |
|
Search options Values in
|
Promise containing Array of Channel
Returns an array of Channel objects or an empty array if no channels were found
Searches for messages
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
query |
string |
|
|||||||||||||||||
|
options |
Object |
Yes |
Values in
|
Promise containing Array of Message
Sends a channel admin invitation to a user, allowing them to become an admin of the channel
| 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 |
|
Promise containing boolean
Returns true if an invitation was sent successfully, false otherwise
Send a message to a specific chatId
| 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 |
Promise containing Message
Message that was just sent
Marks the client as online
Marks the client as unavailable
Send an emoji reaction to a specific message
| Name | Type | Optional | 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. |
Promise
Sends a response to the scheduled event message, indicating whether a user is going to attend the event or not
| Name | Type | Optional | Description |
|---|---|---|---|
|
response |
number |
|
The response code to the scheduled event message. Valid values are: |
|
eventMessageId |
string |
|
The scheduled event message ID |
Promise containing boolean
Mark as seen for the Chat
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
Promise containing boolean
result
Setting autoload download audio
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
Setting autoload download documents
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
Setting autoload download photos
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
Setting autoload download videos
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
Setting background synchronization. NOTE: this action will take effect after you restart the client.
| Name | Type | Optional | Description |
|---|---|---|---|
|
flag |
boolean |
|
true/false |
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.
| Name | Type | Optional | Description |
|---|---|---|---|
|
displayName |
string |
|
New display name |
Promise containing Boolean
Sets the current user's profile picture.
| Name | Type | Optional | Description |
|---|---|---|---|
|
media |
|
Promise containing boolean
Returns true if the picture was properly updated.
Sets the current user's status message
| Name | Type | Optional | Description |
|---|---|---|---|
|
status |
string |
|
New status message |
Subscribe to channel
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID |
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Sync chat history conversation
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
Promise containing boolean
True if operation completed successfully, false otherwise.
Transfers a channel ownership to another user. Note: the user you are transferring the channel ownership to must be a channel admin.
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
|
|
newOwnerId |
string |
|
|
|
options |
|
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Changes and returns the archive state of the Chat
boolean
Unmutes the Chat
| Name | Type | Optional | Description |
|---|---|---|---|
|
chatId |
string |
|
ID of the chat that will be unmuted |
Promise containing {isMuted: boolean, muteExpiration: number}
Unpins the Chat
Promise containing boolean
New pin state
Unsubscribe from channel
| Name | Type | Optional | Description |
|---|---|---|---|
|
channelId |
string |
|
The channel ID |
|
options |
|
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
Emitted when there has been an error while trying to restore an existing session
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
string |
|
Emitted when authentication is successful
Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
batteryInfo |
object |
|
Values in
|
Emitted when the connection state changes
| Name | Type | Optional | Description |
|---|---|---|---|
|
state |
|
the new connection state |
Emitted when a chat is archived/unarchived
| Name | Type | Optional | Description |
|---|---|---|---|
|
chat |
|
||
|
currState |
boolean |
|
|
|
prevState |
boolean |
|
Emitted when a chat is removed
| Name | Type | Optional | Description |
|---|---|---|---|
|
chat |
|
Emitted when a pairing code is received
| Name | Type | Optional | Description |
|---|---|---|---|
|
code |
string |
|
Code |
string
Code that was just received
Emitted when a contact or a group participant changes their phone number.
| 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. |
Emitted when the client has been disconnected
| Name | Type | Optional | Description |
|---|---|---|---|
|
reason |
(WAState or "LOGOUT") |
|
reason that caused the disconnect |
Emitted when a current user is promoted to an admin or demoted to a regular user.
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
Emitted when a user joins the chat via invite link or is added by an admin.
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
Emitted when a user leaves the chat or is removed by an admin.
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
Emitted when some user requested to join the group that has the membership approval mode turned on
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action Values in
|
Emitted when group settings are updated, such as subject, description or picture.
| Name | Type | Optional | Description |
|---|---|---|---|
|
notification |
|
GroupNotification with more information about the action |
Emitted when a call is received
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
call |
object |
|
Values in
|
Emitted when media has been uploaded for a message sent by the client.
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message with media that was uploaded |
Emitted when a new message is received.
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was received |
Emitted when an ack event occurrs on message type.
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was affected |
|
|
ack |
|
The new ACK value |
Emitted when a message is received as ciphertext (not yet decrypted)
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
Emitted when a ciphertext message failed to decrypt after recovery attempt
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
Emitted when a new message is created, which may include the current user's own messages.
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was created |
Emitted when messages are edited
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
||
|
newBody |
string |
|
|
|
prevBody |
string |
|
Emitted when a reaction is sent, received, updated or removed
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
reaction |
object |
|
Values in
|
Emitted when a message is deleted for everyone in the chat.
| 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. |
Emitted when a message is deleted by the current user.
| Name | Type | Optional | Description |
|---|---|---|---|
|
message |
|
The message that was revoked |
Emitted when a QR code is received
| Name | Type | Optional | Description |
|---|---|---|---|
|
qr |
string |
|
QR Code |
Emitted when the client has initialized and is ready to receive messages.
Emitted when some poll option is selected or deselected, shows a user's current selected option(s) on the poll