GroupChat
Source: Structures/
Represents a Group Chat on WhatsApp
Properties
Methods
new GroupChat()
- Extends
- Chat
Properties
archived unknown
Indicates if the Chat is archived
- Inherited from
- Chat#archived
createdAt date
Gets the date at which the group was created
description string
Gets the group description
id unknown
ID that represents the chat
- Inherited from
- Chat#id
isGroup unknown
Indicates if the Chat is a Group Chat
- Inherited from
- Chat#isGroup
isMuted unknown
Indicates if the chat is muted or not
- Inherited from
- Chat#isMuted
isReadOnly unknown
Indicates if the Chat is readonly
- Inherited from
- Chat#isReadOnly
lastMessage unknown
Last message fo chat
- Inherited from
- Chat#lastMessage
muteExpiration unknown
Unix timestamp for when the mute expires
- Inherited from
- Chat#muteExpiration
name unknown
Title of the chat
- Inherited from
- Chat#name
owner ContactId
Gets the group owner
participants Array of GroupParticipant
Gets the group participants
pinned unknown
Indicates if the Chat is pinned
- Inherited from
- Chat#pinned
timestamp unknown
Unix timestamp for when the last activity occurred
- Inherited from
- Chat#timestamp
unreadCount unknown
Amount of messages unread
- Inherited from
- Chat#unreadCount
Methods
addParticipants(participantIds, options) → Promise containing (Object with AddParticipantsResult properties or string)
Adds a list of participants by ID to the group
Parameters
Name | Type | Optional | Description |
---|---|---|---|
participantIds |
(string or Array of string) |
|
|
options |
|
An object thay handles options for adding participants |
- Returns
-
Promise containing (Object with AddParticipantsResult properties or string)
Returns an object with the resulting data or an error message as a string
approveGroupMembershipRequests(options) → Promise containing Array of MembershipRequestActionResult
Approves membership requests if any
Parameter
Name | Type | Optional | Description |
---|---|---|---|
options |
|
Options for performing a membership request action |
- Returns
-
Promise containing Array of MembershipRequestActionResult
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
archive()
Archives this chat
- Inherited from
- Chat#archive
changeLabels(labelIds) → Promise containing void
Add or remove labels to this Chat
Parameter
Name | Type | Optional | Description |
---|---|---|---|
labelIds |
|
|
- Inherited from
- Chat#changeLabels
- Returns
clearMessages() → Promise containing Boolean
Clears all messages from the chat
- Inherited from
- Chat#clearMessages
- Returns
-
result
clearState()
Stops typing or recording in chat immediately.
- Inherited from
- Chat#clearState
delete() → Promise containing Boolean
Deletes the chat
- Inherited from
- Chat#delete
- Returns
-
result
deletePicture() → Promise containing boolean
Deletes the group's picture.
- Returns
-
Promise containing boolean
Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.
demoteParticipants(participantIds) → Promise containing {status: number}
Demotes participants by IDs to regular users
Parameter
Name | Type | Optional | Description |
---|---|---|---|
participantIds |
Array of string |
|
- Returns
-
Promise containing {status: number}
Object with status code indicating if the operation was successful
fetchMessages(searchOptions) → Promise containing Array of Message
Loads chat messages, sorted from earliest to latest.
Parameters
Name | Type | Optional | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
searchOptions |
|
|
Options for searching messages. Right now only limit and fromMe is supported. Values in
|
- Inherited from
- Chat#fetchMessages
- Returns
getContact() → Promise containing Contact
Returns the Contact that corresponds to this Chat.
- Inherited from
- Chat#getContact
- Returns
getGroupMembershipRequests() → Promise containing Array of GroupMembershipRequest
Gets an array of membership requests
- Returns
-
Promise containing Array of GroupMembershipRequest
An array of membership requests
getInviteCode() → Promise containing string
Gets the invite code for a specific group
- Returns
-
Promise containing string
Group's invite code
getLabels() → Promise containing Array of Label
Returns array of all Labels assigned to this Chat
- Inherited from
- Chat#getLabels
- Returns
leave() → Promise
Makes the bot leave the group
- Returns
-
Promise
markUnread()
Mark this chat as unread
- Inherited from
- Chat#markUnread
mute(unmuteDate)
Mutes this chat forever, unless a date is specified
Parameter
Name | Type | Optional | Description |
---|---|---|---|
unmuteDate |
|
|
Date at which the Chat will be unmuted, leave as is to mute forever Value can be null. |
- Inherited from
- Chat#mute
pin() → Promise containing boolean
Pins this chat
- Inherited from
- Chat#pin
- Returns
-
New pin state. Could be false if the max number of pinned chats was reached.
promoteParticipants(participantIds) → Promise containing {status: number}
Promotes participants by IDs to admins
Parameter
Name | Type | Optional | Description |
---|---|---|---|
participantIds |
Array of string |
|
- Returns
-
Promise containing {status: number}
Object with status code indicating if the operation was successful
rejectGroupMembershipRequests(options) → Promise containing Array of MembershipRequestActionResult
Rejects membership requests if any
Parameter
Name | Type | Optional | Description |
---|---|---|---|
options |
|
Options for performing a membership request action |
- Returns
-
Promise containing Array of MembershipRequestActionResult
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
removeParticipants(participantIds) → Promise containing {status: number}
Removes a list of participants by ID to the group
Parameter
Name | Type | Optional | Description |
---|---|---|---|
participantIds |
Array of string |
|
- Returns
-
Promise containing {status: number}
revokeInvite() → Promise containing string
Invalidates the current group invite code and generates a new one
- Returns
-
Promise containing string
New invite code
sendMessage(content[, options]) → Promise containing Message
Send a message to this chat
Parameters
Name | Type | Optional | Description |
---|---|---|---|
content |
|
|
|
options |
|
Yes |
- Inherited from
- Chat#sendMessage
- Returns
-
Message that was just sent
sendSeen() → Promise containing Boolean
Set the message as seen
- Inherited from
- Chat#sendSeen
- Returns
-
result
sendStateRecording()
Simulate recording audio in chat. This will last for 25 seconds.
- Inherited from
- Chat#sendStateRecording
sendStateTyping()
Simulate typing in chat. This will last for 25 seconds.
- Inherited from
- Chat#sendStateTyping
setDescription(description) → Promise containing boolean
Updates the group description
Parameter
Name | Type | Optional | Description |
---|---|---|---|
description |
string |
|
- Returns
-
Promise containing boolean
Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.
setInfoAdminsOnly([adminsOnly]) → Promise containing boolean
Updates the group settings to only allow admins to edit group info (title, description, photo).
Parameter
Name | Type | Optional | Description |
---|---|---|---|
adminsOnly |
boolean |
Yes |
Enable or disable this option Defaults to |
- Returns
-
Promise containing boolean
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
setMessagesAdminsOnly([adminsOnly]) → Promise containing boolean
Updates the group settings to only allow admins to send messages.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
adminsOnly |
boolean |
Yes |
Enable or disable this option Defaults to |
- Returns
-
Promise containing boolean
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
setPicture(media) → Promise containing boolean
Sets the group's picture.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
media |
|
- Returns
-
Promise containing boolean
Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.
setSubject(subject) → Promise containing boolean
Updates the group subject
Parameter
Name | Type | Optional | Description |
---|---|---|---|
subject |
string |
|
- Returns
-
Promise containing boolean
Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
unarchive()
un-archives this chat
- Inherited from
- Chat#unarchive
unmute()
Unmutes this chat
- Inherited from
- Chat#unmute
unpin() → Promise containing boolean
Unpins this chat
- Inherited from
- Chat#unpin
- Returns
-
New pin state