Archive and unarchive chat messages with true or false
{string} id '000000000000@c.us'
{boolean} true or false
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.
Edits message of given message id
The specific message id of the message to be edited
New content of specified message
Common message options
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
Retrieves all unread messages (where ack is -1)
list of messages
Checks if a CHAT contact is online.
chat id: xxxxx@c.us
Retrieves the last seen of a CHAT.
chat id: xxxxx@c.us
Get the reactions of a message
Get the votes of a poll 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
Pin and Unpin chat messages with true or false
{string} id '000000000000@c.us'
{boolean} true or false
Optional
nonExistent: boolean{boolean} Pin chat, non-existent (optional)
object
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 file from path or base64
Deprecated: please use sendFile with options: sendFile(to, content, options)
Chat id
File path or base64
Optional
filename: stringThe file name
Optional
caption: stringCaption for the filename
Sends file base64 parameter should have mime type already defined
Deprecated: please use sendFile with options: sendFile(to, content, options)
Chat id
base64 data
Optional
caption: stringSends 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
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: anyAutomatically 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
Sends message with thumbnail
@deprecated: please use sendText with options
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);
Add groups to community
id
Create a community
Array with groups id
Deactivate a community
id
Remove admin of community participant
id
Get all participants of a community
id
Promote participant of community to admin
id
Remove groups of community
id
Checks if a number is a valid WA number
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.
Retrieves status of given contact
Adds participant to Group
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Creates a new chat group
Group name
Contacts that should be added.
Displays group info from an invitation link (or invitation ID)
Invite code or group link. Example: CMJYfPFqRyE2GxrnkldYED
Retrieve a list of a membership approval requests
Group ID ('000000-000000@g.us')
Promise
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
Retrieves the connection state
Current host device details
Returns browser session token
Optional
removePath: booleanobj [token]
Stop phone Watchdog, more details in startPhoneWatchdog
Create Newsletter
Name Newsletter
Optional
options: { options Newsletter, description and picture
Optional
description?: stringOptional
picture?: stringGet info of your sended order
Your order
Optional
session: stringOptional
options: CreateConfigOptional
catchOptional
catchQRReadonly
loggerOptional
onReadonly
optionsReadonly
sessionOptional
statusGet the puppeteer page instance
The Whatsapp page
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)
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
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
Create a new product on catalog
Buisness profile id ('00000@c.us')
ID of Product
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 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 poll response messages
Disposable object to stop the listening
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
Optional
author?: stringDisposable 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
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
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
Send a image message to status stories
Path or base 64 image
Optional
options: SendStatusOptions & { Send a video message to status stories
Path or base 64 image
Optional
options: SendStatusOptions & {
Block contact