Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/wppconnect-team/wa-js/llms.txt

Use this file to discover all available pages before exploring further.

The WPP.blocklist module exposes WhatsApp Web’s internal BlocklistStore. Blocking a contact prevents them from calling you, sending you messages, or seeing your online status and profile picture. The block is stored on WhatsApp’s servers and applies across all your devices. Contact IDs use the standard {phone}@c.us format.
Blocking only affects direct messaging. If you and a blocked contact share a group, you will still see each other’s messages within that group.

WPP.blocklist.blockContact(chatId)

Blocks a contact. Returns the contact’s WID and their updated block status.
blockContact(chatId: string | Wid): Promise<BlocklistResult>
chatId
string | Wid
required
The @c.us WID of the contact to block.
BlocklistResult
object
const result = await WPP.blocklist.blockContact('15550001234@c.us');
console.log('Blocked:', result.isBlocked); // true

WPP.blocklist.unblockContact(chatId)

Unblocks a previously blocked contact.
unblockContact(chatId: string | Wid): Promise<BlocklistResult>
chatId
string | Wid
required
The @c.us WID of the contact to unblock.
const result = await WPP.blocklist.unblockContact('15550001234@c.us');
console.log('Still blocked:', result.isBlocked); // false

WPP.blocklist.isBlocked(chatId)

Returns true if the given contact is currently blocked, false otherwise. This is a synchronous check against the local BlocklistStore.
isBlocked(chatId: string | Wid): boolean
chatId
string | Wid
required
The @c.us WID to check.
const blocked = WPP.blocklist.isBlocked('15550001234@c.us');
if (blocked) {
  console.log('This contact is blocked');
}
isBlocked reads from the in-memory store and returns instantly. Use it to pre-check before calling blockContact or unblockContact — no network request is needed.

WPP.blocklist.all()

Returns an array of WIDs for every contact currently on the block list. This is a synchronous read from the local store.
all(): Wid[]
const blockedContacts = WPP.blocklist.all();
console.log(`You have ${blockedContacts.length} blocked contact(s)`);

blockedContacts.forEach(wid => {
  console.log(wid.toString());
});

Common patterns

Check the current state and flip it:
const contactId = '15550001234@c.us';
if (WPP.blocklist.isBlocked(contactId)) {
  await WPP.blocklist.unblockContact(contactId);
  console.log('Unblocked');
} else {
  await WPP.blocklist.blockContact(contactId);
  console.log('Blocked');
}
blockContact handles one ID at a time. Use Promise.all to block several contacts concurrently:
const toBlock = [
  '15550001234@c.us',
  '15550005678@c.us',
  '15550009012@c.us',
];

const results = await Promise.all(
  toBlock.map(id => WPP.blocklist.blockContact(id))
);

results.forEach(r => {
  console.log(r.wid.toString(), '→ blocked:', r.isBlocked);
});
Retrieve all blocked WIDs as plain strings:
const blocked = WPP.blocklist.all().map(wid => wid.toString());
console.log(JSON.stringify(blocked, null, 2));

Build docs developers (and LLMs) love