github pedroslopez/whatsapp-web.js v1.2.0
v1.2.0 - Fetch chat messages, group events, state updates

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

Notable changes

Fetch chat messages

This release introduces a feature to fetch old chat messages via the use of Chat.fetchMessages(). By default it will return the last 50 messages, but a custom limit can be specified. This will automatically handle loading messages from the server if needed.

Group events

Event handlers for group events have also been added, allowing you to listen for user joins, user leaves and group settings updates via the group_join, group_leave and group_update events. The current supported GroupNotification types are the following:

  • add: A user has been added to the chat by an admin.
  • invite: A user has joined the chat by using an invitation link.
  • remove: A user has been kicked from the chat by an admin.
  • leave: A user has left the chat voluntarily.
  • subject: The group subject has been changed.
  • description: The group description has been changed.
  • picture: The group picture has been changed.
  • announce: The group settings option for "Send messages" has been modified. On/off in the body indicates if only admins can send messages in the chat or not.
  • restrict: The group settings option for "Edit group info" has been modified. On/off in the body indicates if only admins can edit group subject, description and picture.

The events map to the following types:

  • group_join: emitted when type is either add or invite.
  • group_leave: emitted when type is either remove or leave.
  • group_update: all other types.

Simulate "typing..." and "recording audio..."

You can now do this using the sendStateTyping() and sendStateRecording() functions available on the Chat model. These will last for approximately 25 seconds and can be called again to refresh the timeout. A clearState() function is also available to immediately clear the typing or recording status.

Chats auto marked as seen

After this update, chats will be automatically marked as seen when a message is sent to it. If this is not the intended behavior, sendSeen: false can be set as part of the options object. You can also manually mark a conversation as seen by calling the sendSeen() function on the Chat.

Raw changelog

f34902d - chore: mark version v1.2.0
6e76fec - docs: add jsdoc strings for group events
98458f7 - feat : send conversation seen (#66)
48b9ae1 - feat: listen to group events (#90)
588dc93 - chore: added index.js for structures (#91)
16fe865 - feat: fetch chat messages
b07b38b - feat: Simulate recording audio in chat, clear recording/typing state, standardize chatstate change function names
d35f101 - feat: send typing in chat (#87)
72441be - feat(example): better session data save (#79)
794c9e1 - feat: force state update (#77)
05f57d2 - chore: bump version to v1.1.0-post

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

NewReleases is sending notifications on new releases.