Home / v1.12.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2020-12-29 3.4 kB
v1.12.0.tar.gz 2020-12-29 158.6 kB
v1.12.0.zip 2020-12-29 210.1 kB
Totals: 3 Items   372.1 kB 0

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:

:::js
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:

:::js
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:

:::js
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:

:::js
// 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.

:::js
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)

Source: README.md, updated 2020-12-29