github pedroslopez/whatsapp-web.js v1.15.1

latest releases: v1.26.0, v1.25.0, v1.24.0...
2 years ago

This is a hotfix to address issues with replying to messages with v1.15.0

Patch notes since last version didn't have them:

Patch notes for 1.15.0 and 1.15.1:

  • muteChat's duration parameter is now optional, it defaults to being infinite
  • GroupNotification.getChat() now gives you the group chat the notification occurred in, instead of the client's chat (bugfix)
  • Buttons and List messages are now added.
    example usage
const { Buttons, List } = require('whatsapp-web.js');

// sending buttons
client.sendMessage(to, new Buttons('Body text/ MessageMedia instance', [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}], 'Title here, doesn\'t work with media', 'Footer here'), {caption: 'if you used a MessageMedia instance, use the caption here'})

// sending lists
client.sendMessage(to, new List('Body text/ MessageMedia instance', 'List message button text', [{title: 'sectionTitle', rows: [{id: 'customId', title: 'ListItem2', description: 'desc'}, {title: 'ListItem2'}]}] 'Title here, doesn\'t work with media', 'Footer here'), {caption: 'if you used a MessageMedia instance, use the caption here'})

//getting response
client.on('message', m => {
  if (m.type == 'buttons_response') {
    const {selectedButtonId: bid} = message;
    if (bid == 'customId') m.reply('You chose button 1')
    // this is a buttons message response
  } else if (m.type == 'list_response' /* not sure */) {
    const {selectedButtonId: bid} = message;
    if (bid == 'customId') m.reply('You chose list item 2')
    // this is a list message response
  }
});

docs: https://docs.wwebjs.dev/List.html
https://docs.wewbjs.dev/Buttons.html

  • Incoming payment message type (no sending) supported:
client.on('message', async m => {
   if (message.type == 'payment') {
    const paymentInfo = await m.getPayment();
    // do hat you want here
  }
});

docs: class missing from docs :D

  • force-stop MD users from running a script that's not compatible

  • A new clientOption: qrMaxRetries that allows X qr incoming events before giving up. Defaults to 0 (unlimited)

  • Typescript improvements:

    • Buttons and Lists don't throw errors when sending a message (MessageContent)
    • puppeteer: args and puppeteer: headless don't throw an error
  • Format Ids into human readable phone numbers:

    • Client instance
      .getFormattedNumber(id) and .getCountryCode(id)

    • Contact instance
      .getFormattedId() and .getCountryCode()

both return a Promise (use await)

  • Get the people the client blocked on whatsapp:
const blockedIds = await client.getBlockedIds();
//['62813xxx@c.us', '628xxx@c.us']
  • More tests and related fixes

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

NewReleases is sending notifications on new releases.