Skip to content

v1.16.0 - Multi Device Support

Compare
Choose a tag to compare
@pedroslopez pedroslopez released this 28 Feb 03:51
· 229 commits to main since this release

This release brings support for multidevice-enabled accounts to whatsapp-web.js. Thank you to everyone that contributed to the multidevice branch for making this possible. This release also brings a new way of handling authentication / session restoring.

Auth Strategies

To bring support for multidevice, we had to rethink how the library handles authentication due to internal changes in WhatsApp Web for how tokens are handled on MD.

To make changing how authentication works easier going forward and allow for more extensibility, 1.16 introduces the concept of Authentication Strategies. For more information on the available auth strategies and how they work, please check out the Guide.

Because of this change, the old way of passing session as a client option is now deprecated. But don't worry, you can keep using it via the LegacySessionAuth strategy until WhatsApp eventually removes non-md support.

We recommend everyone move to the LocalAuth strategy if possible, since it supports both MD and Non-MD accounts. We are aware that this method of authentication is less flexible and more difficult to move around, but we are working on ways of making this easier in the future.

Deprecations

These features are still available on 1.16, but will be removed in a later release.

session and restartOnAuthFail client options

As mentioned in the previous section, we are moving towards using auth strategies so these options have been deprecated. You should instead set them as options on the LegacySessionAuth strategy:

const authStrategy = new LegacySessionAuth({
    session: {},
    restartOnAuthFail: false
})
const client = new Client({ authStrategy })

Phone-related properties and events

Because they are not available on MultiDevice and will be removed by WhatsApp in the future, properties and events that access information about the connected phone have been deprecated. This includes the battery events and client.info.phone.

Change log

979e97e - chore: mark version v1.16.0
1f4328c - fix tests
6691d25 - fix: message.getInfo() works for both MD and non-MD
12d9735 - Update README.md
ab5167c - fix: ChangeParticipantsPermissions typo in index.d.ts (#1206)
52c8336 - Added message duration in seconds (#1230)
9fe9169 - update tests to work with authStrategies
f6de161 - Auth Strategies (#1257)
0d55d40 - feat: Multi-device support (#889)