{string} id '000000000000@c.us'
boolean
Unblock contact
{string} id '000000000000@c.us'
boolean
Archive and unarchive chat messages with true or false
{string} id '000000000000@c.us'
{boolean} true or false
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.
Edits message of given message id
The specific message id of the message to be edited
New content of specified message
Common message options
// Simple message
client.editMessage('true_<number>@c.us_messageId', 'new Text For Simple Message');
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
Depreciado em favor de getMessages
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
Depreciado em favor de getMessages
Load more messages in chat object from server. Use this in a while loop Depreciado em favor de getMessages
contact detial as promise
Depreciado em favor de getMessages
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
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
Sends file from path or base64
Chat id
File path
Optional
options: FileMessageOptions// Simple message
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)
Generates 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)
Sends image message
Chat id
File path, http link or base64Encoded
Optional
caption: stringOptional
quotedMessageId: stringQuoted message id
Optional
isViewOnce: booleanEnable single view
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
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: PoolMessageOptions// Single pool
client.sendPollMessage(
'[number]@g.us',
'A poll name',
['Option 1', 'Option 2', 'Option 3']
);
// Selectable Count
// Single pool
client.sendPollMessage(
'[number]@g.us',
'A poll name',
['Option 1', 'Option 2', 'Option 3'],
{
selectableCount: 1,
}
);
Sends 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
Send reaction to message
// For send Reaction, just to send emoji
await client.sendReactionToMessage('[number]@c.us', '🤯');
// to remove reacition
await client.startRecording('[number]@c.us', false);
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');
// 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
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);
Enable or disable temporary messages with true or false
id '000000000000@c.us' or '000000-000000@g.us'
true or false
boolean
Starts recording ('Recording...' state)
Chat Id
Optional
duration: numberDuration um miliseconds
// Keep sending recording state, use stopRecoring to finish
await client.startRecording('[number]@c.us');
// Keep sending typing state for 5 seconds
await client.startRecording('[number]@c.us', 5000);
Starts typing ('Typing...' state)
Chat Id
Optional
duration: numberDuration um miliseconds
// Keep sending typing state, use stopTyping to finish
await client.startTyping('[number]@c.us');
// Keep sending typing state for 5 seconds
await client.startTyping('[number]@c.us', 5000);
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 detial as promise
Checks if a number is a valid whatsapp number
Deprecated in favor of checkNumberStatus
contact detial as promise
Deprecated in favor of checkNumberStatus
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'
Approve a membership request to group
Group ID ('000000-000000@g.us')
Promise
Creates a new chat group
Group name
Contacts that should be added.
Demotes admin privileges of participant
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Generates group-invite link
Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED
Retrieve a list of a membership approval requests
Group ID ('000000-000000@g.us')
Promise
Promotes participant as Admin in given group
Chat id ('0000000000-00000000@g.us')
Participant id'000000000000@c.us'
Reject a membership request to group
Group ID ('000000-000000@g.us')
Promise
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'
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 the connecction state
Current host device details
Returns browser session token
Optional
removePath: booleanobj [token]
Stop phone Watchdog, more details in startPhoneWatchdog
Create New Label
Name of label
Optional
options: stringoptions of label
client.addNewLabel(`Name of label`);
//or
client.addNewLabel(`Name of label`, { labelColor: '#dfaef0' });
//or
client.addNewLabel(`Name of label`, { labelColor: 4292849392 });
Add or delete label of chatId
ChatIds
options to remove or add
client.addOrRemoveLabels(['[number]@c.us','[number]@c.us'],
[{labelId:'76', type:'add'},{labelId:'75', type:'remove'}]);
//or
Create Newsletter
Name Newsletter
Optional
options: { options Newsletter, description and picture
Optional
description?: stringOptional
picture?: stringclient.createNewsletter('Name for your newsletter', {description: 'Description for that', picture: '<base64_string',});
Edit a Newsletter
Optional
opts: { Optional
description?: stringOptional
name?: stringOptional
picture?: stringclient.editNewsletter('[newsletter-id]@newsletter', {
description: 'new description';
name: 'new name';
picture: '<new pic base64>';
});
Optional
session: stringOptional
options: CreateConfigOptional
catchOptional
catchQRReadonly
loggerOptional
onReadonly
optionsReadonly
sessionOptional
statusGet the puppeteer page instance
The Whatsapp page
Add image on product This function include additional images on product for change main image use client.changeProductImage
Product ID
Image in base64
client.addProductImage('56989897878', 'base64/string');
Add image on product This function change main image of product, for change additional images use client.addImage
Product ID
Image in base64
client.changeProductImage('56989897878', 'base64/string');
Create a product on catalog
Product name
Product image
Product description
Product price
Product visibility
Product url
Product own ID system
Product currency
client.createtProduct(
'Product name',
'image in base64',
'product description',
'89.90',
true,
'https://wppconnect.io',
'AKA001',
);
Decrypts message file
Message object
Decrypted file buffer (null otherwise)
Download and returns the media content in base64 format
Message ou 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 a collection
Collection id
Options arguments
client.editCollection('656565898', {
collectionName: 'New Name for collection',
productsToAdd: ['5656523223'],
productsToRemove: ['5656523232']
});
Edit product on catalog
Product ID
Object with options
client.editProduct('56989897878' {
name: 'Product name',
description: 'product description',
price: '89.90',
isHidden: true,
url: 'https://wppconnect.io',
retailerId: 'AKA001',
});
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
client.getCollections('5521988556558@c.us', '10','20');
Retorna uma lista de mensagens de um chat
string ID da conversa ou do grupo
GetMessagesParam Opções de filtragem de resultados (count, id, direction) veja GetMessagesParam.
Message object
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
Listens to messages 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
Message
Escuta por ligações recebidas, seja de áudio ou vídeo.
Para recusar a ligação, basta chamar o rejectCall
rejectCall
Objeto descartável para parar de ouvir
Listens to interface mode change See InterfaceState and InterfaceMode for details
Disposable object to stop the listening
Escuta os eventos de Localização em tempo real de todos os chats Eventos de Localização em tempo real
Função para ser executada quando houver alterações
Objeto descartável para parar de ouvir
Escuta os eventos de Localização em tempo real Eventos de Localização em tempo real
Único ID ou lista de IDs de contatos para acompanhar a localização
Função para ser executada quando houver alterações
Objeto descartável para parar de ouvir
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
Message
Listens to participants changed
Stream of ParticipantEvent
Listens to participants changed
Stream of ParticipantEvent
Listens to presence changed, by default, it will 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 changed, the callback will triggered only for passed IDs Listens to presence changed
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 reaction messages
Disposable object to stop the listening
Listens to revoked messages
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
client.removeProductImage('56989897878', '1');
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 & { client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>');
// Send with caption
client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>', { caption: 'example test' } );
Send a video message to status stories
Path or base 64 image
Optional
options: SendStatusOptions & { client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>');
// Send with caption
client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>', { caption: 'example test' } );
Generated using TypeDoc
Block contact