Extends
Members
archived :boolean
Indicates if the Chat is archived
Type:
- boolean
- Inherited From:
- Source:
createdAt :date
Gets the date at which the group was created
Type:
- date
- Source:
description :string
Gets the group description
Type:
- string
- Source:
id :object
ID that represents the chat
Type:
- object
- Inherited From:
- Source:
isGroup :boolean
Indicates if the Chat is a Group Chat
Type:
- boolean
- Inherited From:
- Source:
isLocked :boolean
Indicates if the Chat is locked
Type:
- boolean
- Inherited From:
- Source:
isMuted :boolean
Indicates if the chat is muted or not
Type:
- boolean
- Inherited From:
- Source:
isReadOnly :boolean
Indicates if the Chat is readonly
Type:
- boolean
- Inherited From:
- Source:
lastMessage :Message
Last message fo chat
Type:
- Inherited From:
- Source:
muteExpiration :number
Unix timestamp for when the mute expires
Type:
- number
- Inherited From:
- Source:
name :string
Title of the chat
Type:
- string
- Overrides:
- Source:
owner :ContactId
Gets the group owner
Type:
- Source:
participants :Array.<GroupParticipant>
Gets the group participants
Type:
- Array.<GroupParticipant>
- Source:
pinned :boolean
Indicates if the Chat is pinned
Type:
- boolean
- Inherited From:
- Source:
timestamp :number
Unix timestamp for when the last activity occurred
Type:
- number
- Inherited From:
- Source:
unreadCount :number
Amount of messages unread
Type:
- number
- Inherited From:
- Source:
Methods
(async) addOrEditCustomerNote(note) → {Promise.<void>}
Add or edit a customer note
Parameters:
| Name | Type | Description |
|---|---|---|
note |
string | The note to add Customer notes are available only to eligible WhatsApp Business accounts. |
- Inherited From:
- Source:
- See:
Returns:
- Type
- Promise.<void>
(async) addParticipants(participantIds, options) → {Promise.<(Object.<string, AddParticipantsResult>|string)>}
Adds a list of participants by ID to the group
Parameters:
| Name | Type | Description |
|---|---|---|
participantIds |
string | Array.<string> | |
options |
AddParticipnatsOptions | An object thay handles options for adding participants |
- Source:
Returns:
Returns an object with the resulting data or an error message as a string
- Type
- Promise.<(Object.<string, AddParticipantsResult>|string)>
(async) approveGroupMembershipRequests(options) → {Promise.<Array.<MembershipRequestActionResult>>}
Approves membership requests if any
Parameters:
| Name | Type | Description |
|---|---|---|
options |
MembershipRequestActionOptions | Options for performing a membership request action |
- Source:
Returns:
Returns an array of requester IDs whose membership requests were approved and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
- Type
- Promise.<Array.<MembershipRequestActionResult>>
(async) archive()
Archives this chat
- Inherited From:
- Source:
(async) changeLabels(labelIds) → {Promise.<void>}
Add or remove labels to this Chat
Parameters:
| Name | Type | Description |
|---|---|---|
labelIds |
Array.<(number|string)> |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<void>
(async) clearMessages() → {Promise.<boolean>}
Clears all messages from the chat
- Inherited From:
- Source:
Returns:
result
- Type
- Promise.<boolean>
(async) clearState()
Stops typing or recording in chat immediately.
- Inherited From:
- Source:
(async) delete() → {Promise.<Boolean>}
Deletes the chat
- Inherited From:
- Source:
Returns:
result
- Type
- Promise.<Boolean>
(async) deletePicture() → {Promise.<boolean>}
Deletes the group's picture.
- Source:
Returns:
Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) demoteParticipants(participantIds) → {Promise.<{status: number}>}
Demotes participants by IDs to regular users
Parameters:
| Name | Type | Description |
|---|---|---|
participantIds |
Array.<string> |
- Source:
Returns:
Object with status code indicating if the operation was successful
- Type
- Promise.<{status: number}>
(async) fetchMessages(searchOptions) → {Promise.<Array.<Message>>}
Loads chat messages, sorted from earliest to latest.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
searchOptions |
Object | Options for searching messages. Right now only limit and fromMe is supported. Properties
|
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Array.<Message>>
(async) getContact() → {Promise.<Contact>}
Returns the Contact that corresponds to this Chat.
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Contact>
(async) getCustomerNote() → {Promise.<({chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}|null)>}
Get a customer note
- Inherited From:
- Source:
- See:
Returns:
Null when customer notes are unavailable for the account or this is a group/channel.
- Type
- Promise.<({chatId: string, content: string, createdAt: number, id: string, modifiedAt: number, type: string}|null)>
(async) getGroupMembershipRequests() → {Promise.<Array.<GroupMembershipRequest>>}
Gets an array of membership requests
- Source:
Returns:
An array of membership requests
- Type
- Promise.<Array.<GroupMembershipRequest>>
(async) getInviteCode() → {Promise.<string>}
Gets the invite code for a specific group
- Source:
Returns:
Group's invite code
- Type
- Promise.<string>
(async) getLabels() → {Promise.<Array.<Label>>}
Returns array of all Labels assigned to this Chat
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Array.<Label>>
(async) getPinnedMessages() → {Promise.<Array.<Message>>}
Gets instances of all pinned messages in a chat
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Array.<Message>>
(async) leave() → {Promise}
Makes the bot leave the group
- Source:
Returns:
- Type
- Promise
(async) markUnread()
Mark this chat as unread
- Inherited From:
- Source:
(async) mute(unmuteDatenullable) → {Promise.<{isMuted: boolean, muteExpiration: number}>}
Mutes this chat forever, unless a date is specified
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
unmuteDate |
Date |
<nullable> |
Date when the chat will be unmuted, don't provide a value to mute forever |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<{isMuted: boolean, muteExpiration: number}>
(async) pin() → {Promise.<boolean>}
Pins this chat
- Inherited From:
- Source:
Returns:
New pin state. Could be false if the max number of pinned chats was reached.
- Type
- Promise.<boolean>
(async) promoteParticipants(participantIds) → {Promise.<{status: number}>}
Promotes participants by IDs to admins
Parameters:
| Name | Type | Description |
|---|---|---|
participantIds |
Array.<string> |
- Source:
Returns:
Object with status code indicating if the operation was successful
- Type
- Promise.<{status: number}>
(async) rejectGroupMembershipRequests(options) → {Promise.<Array.<MembershipRequestActionResult>>}
Rejects membership requests if any
Parameters:
| Name | Type | Description |
|---|---|---|
options |
MembershipRequestActionOptions | Options for performing a membership request action |
- Source:
Returns:
Returns an array of requester IDs whose membership requests were rejected and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
- Type
- Promise.<Array.<MembershipRequestActionResult>>
(async) removeParticipants(participantIds) → {Promise.<{status: number}>}
Removes a list of participants by ID to the group
Parameters:
| Name | Type | Description |
|---|---|---|
participantIds |
Array.<string> |
- Source:
Returns:
- Type
- Promise.<{status: number}>
(async) revokeInvite() → {Promise.<string>}
Invalidates the current group invite code and generates a new one
- Source:
Returns:
New invite code
- Type
- Promise.<string>
(async) sendMessage(content, optionsopt) → {Promise.<(Message|null|undefined)>}
Send a message to this chat
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
content |
string | MessageMedia | Location | ||
options |
MessageSendOptions |
<optional> |
- Inherited From:
- Source:
Returns:
Message that was just sent
- Type
- Promise.<(Message|null|undefined)>
(async) sendSeen() → {Promise.<Boolean>}
Sets the chat as seen
- Inherited From:
- Source:
Returns:
result
- Type
- Promise.<Boolean>
(async) sendStateRecording()
Simulate recording audio in chat. This will last for 25 seconds.
- Inherited From:
- Source:
(async) sendStateTyping()
Simulate typing in chat. This will last for 25 seconds.
- Inherited From:
- Source:
(async) setAddMembersAdminsOnly(adminsOnlyopt) → {Promise.<boolean>}
Updates the group setting to allow only admins to add members to the group.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
adminsOnly |
boolean |
<optional> |
true | Enable or disable this option |
- Source:
Returns:
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) setDescription(description) → {Promise.<boolean>}
Updates the group description
Parameters:
| Name | Type | Description |
|---|---|---|
description |
string |
- Source:
Returns:
Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) setInfoAdminsOnly(adminsOnlyopt) → {Promise.<boolean>}
Updates the group settings to only allow admins to edit group info (title, description, photo).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
adminsOnly |
boolean |
<optional> |
true | Enable or disable this option |
- Source:
Returns:
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) setMessagesAdminsOnly(adminsOnlyopt) → {Promise.<boolean>}
Updates the group settings to only allow admins to send messages.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
adminsOnly |
boolean |
<optional> |
true | Enable or disable this option |
- Source:
Returns:
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) setPicture(media) → {Promise.<boolean>}
Sets the group's picture.
Parameters:
| Name | Type | Description |
|---|---|---|
media |
MessageMedia |
- Source:
Returns:
Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) setSubject(subject) → {Promise.<boolean>}
Updates the group subject
Parameters:
| Name | Type | Description |
|---|---|---|
subject |
string |
- Source:
Returns:
Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
- Type
- Promise.<boolean>
(async) syncHistory() → {Promise.<boolean>}
Sync chat history conversation
- Inherited From:
- Source:
Returns:
True if operation completed successfully, false otherwise.
- Type
- Promise.<boolean>
(async) unarchive()
un-archives this chat
- Inherited From:
- Source:
(async) unmute() → {Promise.<{isMuted: boolean, muteExpiration: number}>}
Unmutes this chat
- Inherited From:
- Source:
Returns:
- Type
- Promise.<{isMuted: boolean, muteExpiration: number}>
(async) unpin() → {Promise.<boolean>}
Unpins this chat
- Inherited From:
- Source:
Returns:
New pin state
- Type
- Promise.<boolean>