{string} id '000000000000@c.us'
boolean
Receive all blocked contacts
array of [0,1,2,3....]
Unblock contact
{string} id '000000000000@c.us'
boolean
Deletes all messages of given chat
Keep starred messages
boolean
Deletes the given chat
{string} id '000000000000@c.us'
boolean
Deletes message of given message id
The chat id from which to delete the message.
The specific message id of the message to be deleted
If it should only delete locally (message remains on the other recipienct's phone). Defaults to false.
Forwards array of messages (could be ids or message objects)
Optional
options: ForwardMessagesOptionsarray of messages ID
Retrieves all messages already loaded in a chat For loading every message use loadAndGetAllMessagesInChat Depreciado em favor de getMessages
any
Checks if a CHAT contact is online.
chat id: xxxxx@c.us
Retrieves the last seen of a CHAT.
chat id: xxxxx@c.us
Returns a list of mute and non-mute users
Optional
type: stringreturn type: all, toMute and noMute.
obj
Get the platform message from message ID
The platform can be: android iphone web unknown
Get the reactions of a message
Return list of chats *
Optional
options: ChatListOptionsarray of [Chat]
// All chats
const chats = await client.listChats();
// Some chats
const chats = client.listChats({count: 20});
// 20 chats before specific chat
const chats = client.listChats({count: 20, direction: 'before', id: '[number]@c.us'});
// Only users chats
const chats = await client.listChats({onlyUsers: true});
// Only groups chats
const chats = await client.listChats({onlyGroups: true});
// Only with label Text
const chats = await client.listChats({withLabels: ['Test']});
// Only with label id
const chats = await client.listChats({withLabels: ['1']});
// Only with label with one of text or id
const chats = await client.listChats({withLabels: ['Alfa','5']});
Loads and Retrieves all Messages in a chat Depreciado em favor de getMessages
any
Load more messages in chat object from server. Use this in a while loop Depreciado em favor de getMessages
contact details as promise
Sets a audio or image view once. Marks message as played
Message id: xxxxx@us.c
puts the chat as unread
{string} id '000000000000@c.us'
boolean
Replies to given mesage id of given chat id
Deprecated: Please, use sendText with quotedMsg option
Chat id
Message body
Message id to reply to.
Sends contact card to iven chat id
Chat id
Optional
name: stringSend a list of contact cards
Chat id
Example: | ['000@c.us', '1111@c.us', {id: '2222@c.us', name: 'Test'}]
Sends file from path or base64
Chat id
File path
Optional
options: FileMessageOptions// File message from a path
client.sendFile('<number>@c.us', './someFile.txt');
// Simple message from base64
client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==');
// With buttons
client.sendFile('<number>@c.us', 'data:text/plain;base64,V1BQQ29ubmVjdA==', {
useTemplateButtons: true, // False for legacy
buttons: [
{
url: 'https://wppconnect.io/',
text: 'WPPConnect Site'
},
{
phoneNumber: '+55 11 22334455',
text: 'Call me'
},
{
id: 'your custom id 1',
text: 'Some text'
},
{
id: 'another id 2',
text: 'Another text'
}
],
title: 'Title text' // Optional
footer: 'Footer text' // Optional
});
Sends a video to given chat as a gif, with caption or not, using base64
Chat id
File path
Optional
filename: stringOptional
caption: stringSends a video to given chat as a gif, with caption or not, using base64
chat id xxxxx@us.c
base64 data:video/xxx;base64,xxx
string xxxxx
Optional
caption: stringstring xxxxx
Sends image message
Chat id
File path or http link
Optional
filename: stringOptional
caption: stringOptional
quotedMessageId: stringQuoted message id
Optional
isViewOnce: booleanEnable single view
Optional
options: { mentionedList?: string[]; msgId?: string }Generates sticker from given image and sends it (Send Image As Sticker)
chatId '000000000000@c.us'
image path imageBase64 A valid png, jpg and webp image is required. You can also send via http/https (http://www.website.com/img.gif)
Optional
options: AllMessageOptionsGenerates sticker from the provided animated gif image and sends it (Send image as animated sticker)
chatId '000000000000@c.us'
image path imageBase64 A valid gif image is required. You can also send via http/https (http://www.website.com/img.gif)
Optional
options: AllMessageOptionsSends image message
ID of the chat to send the image to
A base64-encoded data URI (with mime type)
Optional
caption: stringOptional
quotedMessageId: stringQuoted message id
Optional
isViewOnce: booleanEnable single view
Optional
mentionedList: anyOptional
options: { msgId?: string }Automatically sends a link with the auto generated link preview. You can also add a custom message to be added.
Deprecated: please use sendText
string A link, for example for youtube. e.g https://www.youtube.com/watch?v=Zi_XLOBDo_Y&list=RDEMe12_MlgO8mGFdeeftZ2nOQ&start_radio=1
custom text as the message body, this includes the link or will be attached after the link
Sends a list message
// Example
client.sendListMessage('<number>@c.us', {
buttonText: 'Click here',
description: 'Choose one option',
sections: [
{
title: 'Section 1',
rows: [
{
rowId: 'my_custom_id',
title: 'Test 1',
description: 'Description 1',
},
{
rowId: '2',
title: 'Test 2',
description: 'Description 2',
},
],
},
],
});
Sends location to given chat id
Chat id
location options
Sends location to given chat id
Chat id
Latitude
Longitude
Text caption
Sends text with tags
Optional
options: anySends message with thumbnail
@deprecated: please use sendText with options
duration of silence
kind of silence "hours" "minutes" "year" To remove the silence, just enter the contact parameter
Send a order message To send (prices, tax, shipping or discount), for example: USD 12.90, send them without dots or commas, like: 12900
Optional
options: OrderMessageOptions// Send Order with a product
client.sendOrderMessage('[number]@c.us', [
{ type: 'product', id: '67689897878', qnt: 2 },
{ type: 'product', id: '37878774457', qnt: 1 },
]
// Send Order with a custom item
client.sendOrderMessage('[number]@c.us', [
{ type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
]
// Send Order with custom options
client.sendOrderMessage('[number]@c.us', [
{ type: 'product', id: '37878774457', qnt: 1 },
{ type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
],
{ tax: 10000, shipping: 4000, discount: 10000 }
Send a create poll message
Optional
options: PoolMessageOptionsSends ptt audio from path
Chat id
File path
Optional
filename: stringOptional
caption: stringOptional
quotedMessageId: stringQuoted message id
Optional
messageId: stringSet the id for this message
Sends ptt audio base64 parameter should have mime type already defined
Chat id
base64 data
Optional
caption: stringOptional
quotedMessageId: stringQuoted message id
Optional
messageId: stringSet the id for this message
Sends a text message to given chat
chat id: xxxxx@us.c
text message
Optional
options: TextMessageOptions// Simple message
client.sendText('<number>@c.us', 'A simple message');
// A message with reply
client.sendText('<number>@c.us', 'A simple message', {
quotedMsg: 'true_...@c.us_3EB01DE65ACC6_out'
});
// With buttons
client.sendText('<number>@c.us', 'WPPConnect message with buttons', {
useTemplateButtons: true, // False for legacy
buttons: [
{
url: 'https://wppconnect.io/',
text: 'WPPConnect Site'
},
{
phoneNumber: '+55 11 22334455',
text: 'Call me'
},
{
id: 'your custom id 1',
text: 'Some text'
},
{
id: 'another id 2',
text: 'Another text'
}
],
title: 'Title text' // Optional
footer: 'Footer text' // Optional
});
Sends a video to given chat as a gif, with caption or not
Chat id
File path
Optional
filename: stringOptional
caption: stringSends a video to given chat as a gif, with caption or not, using base64
chat id xxxxx@us.c
base64 data:video/xxx;base64,xxx
string xxxxx
Optional
caption: stringstring xxxxx
Optional
quotedMessageId: stringSets the chat state Deprecated in favor of Use startTyping or startRecording functions
Change limits of whatsapp web *
//Change the maximum size (bytes) for uploading media (max 70MB)
WPP.conn.setLimit('maxMediaSize',16777216);
//Change the maximum size (bytes) for uploading files (max 1GB)
WPP.conn.setLimit('maxFileSize',104857600);
//Change the maximum number of contacts that can be selected when sharing (Default 5)
WPP.conn.setLimit('maxShare',100);
//Change the maximum time (seconds) of a video status
WPP.conn.setLimit('statusVideoMaxDuration',120);
//Remove pinned conversation limit (only whatsapp web) (Default 3)
WPP.conn.setLimit('unlimitedPin',true);
Update your online presence
true for available presence and false for unavailable
Enable or disable temporary messages with true or false
id '000000000000@c.us' or '000000-000000@g.us'
true or false
boolean
Stars message of given message id
The specific message id of the message to be starred
Add or remove star of the message. Defaults to true.
Starts recording ('Recording...' state)
Chat Id
Optional
duration: numberDuration um miliseconds
Starts typing ('Typing...' state)
Chat Id
Optional
duration: numberDuration um miliseconds
Stops recording ('Recording...' state)
Chat Id
Stops typing ('Typing...' state)
Chat Id
Add groups to community
id
Create a community
Array with groups id
Remove groups of community
id
Checks if a number is a valid WA number
contact details as promise
Retrieves contact detail object of given contact id
contact details as promise
Checks if a number is a valid whatsapp number
Deprecated in favor of checkNumberStatus
contact details as promise
Retorna dados da imagem do contato
Chat id
url of the chat picture or undefined if there is no picture for the chat.
Adds participant to Group
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Demotes admin privileges of participant
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Displays group info from an invitation link (or invitation ID)
Invite code or group link. Example: CMJYfPFqRyE2GxrnkldYED
Generates group-invite link
Invitation link
Returns current group members as [Contact] objects
For previous members, see groupMetadata.pastParticipants
.
Get the max number of participants for a group
number
Removes the host device from the group
group id
Promotes participant as Admin in given group
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Set group subject (if allowed)
Group ID ('0000000000@g.us')
empty object
Removes participant from group
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Revokes group-invite link and generates a new one.
Invitation link
Set group description (if allowed)
Group ID ('000000-000000@g.us')
New group description
empty object
Set group icon
Group ID ('000000-000000@g.us')
empty object
Enable or disable group properties, see for details
Group ID ('000000-000000@g.us')
true or false
empty object
Set group subject (if allowed)
Group ID ('000000-000000@g.us')
New group subject
empty object
Allow only admin to send messages with true or false
{string} id '000000000000@c.us'
{boolean} true or false
boolean
Retrieves Battery Level
Retrieves the connection state
Current host device details
Returns browser session token
Optional
removePath: booleanobj [token]
Receive the current theme
string light or dark
Retrieves WA-JS version
Retrieves WA version
Current wid connected
Retrieve if is authenticated
Retrieves if the phone is online. Please note that this may not be real time.
Retrieves if the phone is online. Please note that this may not be real time.
Retrieve if main interface is initializing
Retrieve if main interface is authenticated and loaded, bot not synced
Retrieve main interface is authenticated, loaded and synced
Check the current session is an MultiDevice session
Check is online
Join or leave of WhatsApp Web beta program. Will return the value seted
Change the theme
Start phone Watchdog, forcing the phone connection verification.
interval number in miliseconds
Stop phone Watchdog, more details in startPhoneWatchdog
Create Newsletter
Name Newsletter
Optional
options: { description?: string; picture?: string }options Newsletter, description and picture
Optional
session: stringOptional
options: CreateConfigOptional
catchOptional
catchQRReadonly
loggerOptional
onReadonly
optionsReadonly
sessionOptional
statusGet the puppeteer page instance
The Whatsapp page
Internal
Closes page and browser
Create a product on catalog
Product name
Product image
Product description
Product price
Product visibility
Product url
Product own ID system
Product currency
Decrypts message file
Message object
Decrypted file buffer (null
otherwise)
Decrypts message file
Message object
Decrypted file buffer (null otherwise)
Download and returns the media content in base64 format
Message or id
Base64 of media
Update your business profile
await client.editBusinessProfile({description: 'New description for profile'});
await client.editBusinessProfile({categories: {
id: "133436743388217",
localized_display_name: "Artes e entretenimento",
not_a_biz: false,
}});
await client.editBusinessProfile({address: 'Street 01, New York'});
await client.editBusinessProfile({email: 'test@test.com.br'});
Change website of profile (max 2 sites)
await client.editBusinessProfile({website: [
"https://www.wppconnect.io",
"https://www.teste2.com.br",
]});
Change businessHours for Specific Hours
await client.editBusinessProfile({ businessHours: {
{
tue: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
wed: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
thu: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
fri: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
sat: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
sun: {
mode: "specific_hours",
hours: [
[
540,
1080,
],
],
},
}
},
timezone: "America/Sao_Paulo"
});
Change businessHours for Always Opened
```javascript
await client.editBusinessProfile({ businessHours: {
{
mon: {
mode: "open_24h",
},
tue: {
mode: "open_24h",
},
wed: {
mode: "open_24h",
},
thu: {
mode: "open_24h",
},
fri: {
mode: "open_24h",
},
sat: {
mode: "open_24h",
},
sun: {
mode: "open_24h",
},
}
timezone: "America/Sao_Paulo"
});
Change businessHours for Appointment Only
```javascript
await client.editBusinessProfile({ businessHours: { {
mon: {
mode: "appointment_only",
},
tue: {
mode: "appointment_only",
},
wed: {
mode: "appointment_only",
},
thu: {
mode: "appointment_only",
},
fri: {
mode: "appointment_only",
},
sat: {
mode: "appointment_only",
},
sun: {
mode: "appointment_only",
},
}
timezone: "America/Sao_Paulo"
});
Edit product on catalog
Product ID
Object with options
Get Business Profile
Buisness profile id ('00000@c.us')
Querys product catalog
Buisness profile id ('00000@c.us')
Query all collections
Product ID
Max qnt collections - Default 10
Max products in array products of collection - Default 10
Returns a list of messages from a chat
string ID of the conversation or group
GetMessagesParam Result filtering options (count, id, direction) see GetMessagesParam.
Message object
Querys order catalog
string
Message object
Internal
Return PID process
Create a new product on catalog
Buisness profile id ('00000@c.us')
ID of Product
Querys all products
Buisness profile id ('00000@c.us')
limit to load products - Default: 10
Log out of WhatsApp
boolean
Listens to message acknowledgement changes
Disposable object to stop the listening
Fires callback with Chat object every time the host phone is added to a group.
Disposable object to stop the listening
Listens to all new messages, sent and received.
Disposable object to stop the listening
Listen for incoming calls, whether audio or video (pending a reaction).
To reject the call, simply call rejectCall
rejectCall
Disposable object to stop listening
Listens to interface mode change See InterfaceState and InterfaceMode for details
Disposable object to stop the listening
Listens to real-time location events of all chats Real-time location events
Function to be executed when changes are made
Disposable object to stop listening
Listens to location events in real time Location events in real time
Unique ID or list of contact IDs to track location
Function to be executed when changes are made
Disposable object to stop listening
Listens to all new messages received only.
Disposable object to stop the listening
Listens to all notification messages, like group changes, join, leave
Disposable object to stop the listening
Listens to update order status
Disposable object to stop the listening
Listens to participant changes
Function to be executed when participant changes occur
Stream of ParticipantEvent
Listens to participant changes in a certain group
xxxxx-yyyy@us.c
Function to be executed when participant changes occur
Stream of ParticipantEvent
Listens to presence changed, by default, it will be triggered for active chats only or contacts subscribed (see subscribePresence) Listens to presence changed
Callback of on presence changed
Disposable object to stop the listening
Listens to presence changes, the callback will triggered only for passed IDs Listens to presence changes
contact id (xxxxx@c.us) or group id: xxxxx-yyyy@g.us
Callback of on presence changed
Disposable object to stop the listening
Listens to message reactions
Disposable object to stop the listening
Listens to message revocation
Disposable object to stop the listening
Listens List of mobile states
Disposable object to stop the listening
Returns the current state of the connection
Disposable object to stop the listening
Listens to update label
Disposable object to stop the listening
Rejects a call received via WhatsApp
Optional
callId: stringstring Call ID, if not passed, all calls will be rejected
Number of rejected calls
Remove image on product This function remove additional images of product for change main image use client.changeProductImage
Product ID
Index array of additional imagens
Sends product with product image to given chat id
Chat id
Base64 image data
Message body
Business id number that owns the product ('0000@c.us')
Product id, see method getBusinessProfilesProducts for more info
Subscribe presence of a contact or group to use in onPresenceChanged (see onPresenceChanged)
// subcribe all contacts
const contacts = await client.getAllContacts();
await client.subscribePresence(contacts.map((c) => c.id._serialized));
// subcribe all groups participants
const chats = await client.getAllGroups(false);
for (const c of chats) {
const ids = c.groupMetadata.participants.map((p) => p.id._serialized);
await client.subscribePresence(ids);
}
contact id (xxxxx@c.us) or group id: xxxxx-yyyy@g.us
number of subscribed
Get the puppeteer page screenshot
The Whatsapp page screenshot as a PNG encoded in base64 (not the full data URI, just the base64 section)
Unsubscribe presence of a contact or group to use in onPresenceChanged (see onPresenceChanged)
contact id (xxxxx@c.us) or group id: xxxxx-yyyy@g.us
number of unsubscribed
Clicks on 'use here' button (When it gets unlaunched) This method tracks the class of the button WhatsApp Web might change this class name over time Don't rely on this method
Gets the current user profile name
Gets current user profile status
Remove your profile picture
Sets current user profile name
Sets the user's current profile photo
Optional
to: stringSets current user profile status
Send a image message to status stories
Path or base 64 image
Optional
options: SendStatusOptions & { caption?: string }Send a video message to status stories
Path or base 64 image
Optional
options: SendStatusOptions & { caption?: string }Closes the currently opened chat (if any). The boolean result reflects if there was any chat that got closed.
Return the currently active chat (visually open)
Opens given chat at last message (bottom) Will fire natural workflow events of whatsapp web
Opens chat at given message position
Chat id
Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030')
Block contact