github pedroslopez/whatsapp-web.js v1.12.0

latest releases: v1.24.0, v1.23.1-alpha.6, v1.23.1-alpha.5...
3 years ago

This is a big one! v1.12.0 introduces many long-awaited features thanks to our great contributors.

What's New

Send stickers

You can finally send stickers with the library! Stickers are sent just like any other media type. You just need to make sure to specify the option sendMediaAsSticker: true when sending the message:

const sticker = MessageMedia.fromFilePath('/path/to/image.png');
chat.sendMessage(sticker, { sendMediaAsSticker: true });

The library takes care of converting the media internally to an acceptable format.

Animated stickers are also supported, but it's worth noting that conversion to webp is done through ffmpeg. You'll need to have it installed if you want to send animated stickers that are not already in webp format. By default the ffmpeg path is set to ffmpeg, but if you have it installed in a different path, you can set it manually when creating the client:

const client = new Client({
    ffmpegPath: '/path/to/ffmpeg.exe'
});

Send media as document/file

Much like sending stickers, you can now send media files like pictures, audio and video as documents by using the sendMediaAsDocument: true option when sending the message:

const media = MessageMedia.fromFilePath('/path/to/image.png');
chat.sendMessage(media, { sendMediaAsDocument: true });

Messages

Some new features have been added to the Message model:

  • Star/unstar messages (msg.star() and msg.unstar()) and get the current star status msg.isStarred
  • Get parsed links included in the message (msg.links)
  • Get detailed message delivery information. This will allow you to see who and when group messages have been delivered/read/played by each participant. (msg.getInfo())

Business Labels

If you're running WhatsApp Business:

// Get labels
const labels = await client.getLabels();
const label = await client.getLabelById(labelId);

// Get Chat's assigned labels
const labels = await chat.getLabels();
const labels = await client.getChatLabels(chatId);

// Get Chats for a specific label
const chats = await label.getChats();
const chats = await client.getChatsByLabelId(labelId);

Contact "About" info

You can now get a Contact's "About" text (previously named "Status"). This can return null if you don't have permission to read their status.

const aboutText = await contact.getAbout();

and more...

Change log

1bdc733 - chore: mark version v1.12.0
bb9d160 - docs: switch links to point to the guide
cea1830 - docs: fix error generating Label docs
f639c53 - feat: Get message delivery information (close #418)
3e32fe2 - feat: mark chat as unread (#475)
5c61957 - feat: add GroupChat types (#485)
3257549 - docs: fix typo
5a0ccc8 - feat: added starred indicator to messages (#501)
1b94694 - feat: star/unstar messages (#494)
71dbe99 - feat: get Contact's "About" text (close #491)
8b101d1 - feat: get links included in message (#457)
e2a642a - feat: send media as stickers (#479)
0c0a5a7 - docs: fix slight typo
e141a5d - feat: send media as document (#490)
576768e - feat: Get registered ID for a given phone number (#483)
87cb5a0 - feat(interface): Open chat search, open chat at message position (#447)
274d240 - feat: WA Business Labels support (#407)

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

NewReleases is sending notifications on new releases.