github pedroslopez/whatsapp-web.js v1.11.0
v1.11.0 - WhatsApp Web v2.2045.15 compatibility, Contact features

3 years ago

Important update

Whatsapp Web v2.2045.15 has introduced breaking changes that impact the ability to send messages and get chats. This release addresses these issues, and updating is required.

New features

Send Contacts

You can pass an instance of the Contact object to send WhatsApp contacts:

chat.sendMessage(contact);  // Single contact
chat.sendMessage([contact1, contact2]); // List of contacts

You can also send vCard strings as the message body and they will be automatically parsed and transformed into contact cards:

chat.sendMessage("BEGIN:VCARD\nVERSION:3.0\nN: ....");

This functionality is enabled by default, but if you would like to turn off auto vCard parsing, you can do so by passing an option to the sendMessage function:

chat.sendMessage("BEGIN:VCARD\nVERSION:3.0\nN: ...", {
    parseVCards: false
})

Block Contacts

You can now block / unblock contacts:

contact.block();
contact.unblock();

Get multiple vCards

Previously, you weren't able to get the vCard data if multiple contacts were sent at once. Now you can do so with the message's vCard property:

message.vCards;
// returns ["BEGIN:VCARD\nVERSION:3.0\nN: ...", "BEGIN:VCARD\nVERSION:3.0\nN: ..." ]

Deprecations

client.info.me has been deprecated due to a change in WhatsApp Web internals. Instead, you should use client.info.wid to get the current user ID. The old property will continue working, but you should change all occurrences to the new property since it will be removed on a later release.

Changelog

709c43c - feat: add received vcards to the message (#400)
43aa6b3 - chore: add blocking functionality to readme
fc7a1a9 - fix: address removal of Conn.me This change on WhatsApp Web v2.2045.15 caused errors when sending messages and getting the current user id
b0465ce - fix: expose GroupMetadata WhatsApp Web v2.2045.15+ no longer has this in the store by default
e520a96 - fix: serialize msgs.buttons and delete msgs from chat model (#402)
75296b6 - feat: add received vcards to the message.
b15ec76 - fix: show multiple vcard as array in body
42dd866 - feat: boolean for indicating Status update messages (#396)
20e07c4 - feat: block/unblock contacts (#397)
9b096db - feat: Send contacts (#395)
668106b - chore: add group settings functionality to readme

Don't miss a new whatsapp-web.js release

NewReleases is sending notifications on new releases.