From 2128f977292fb5820bed520a466b8b9f8cdba807 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Sat, 31 May 2025 18:37:38 +0000 Subject: [PATCH] chore(): generate docs --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 6 +- docs/Broadcast.html | 6 +- docs/BusinessContact.html | 6 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Channel.html | 911 ++ docs/Chat.html | 12 +- docs/Client.html | 11220 +++++++++++------ docs/Client.js.html | 419 +- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 10 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/List.html | 6 +- docs/LocalAuth.html | 6 +- docs/LocalWebCache.html | 6 +- docs/Location.html | 6 +- docs/Message.html | 6 +- docs/MessageMedia.html | 6 +- docs/NoAuth.html | 6 +- docs/Order.html | 6 +- docs/Poll.html | 6 +- docs/PollVote.html | 6 +- docs/PrivateChat.html | 10 +- docs/PrivateContact.html | 6 +- docs/Product.html | 6 +- docs/Reaction.html | 6 +- docs/RemoteAuth.html | 6 +- docs/RemoteWebCache.html | 6 +- docs/Util.html | 6 +- docs/WebCache.html | 6 +- docs/authStrategies_BaseAuthStrategy.js.html | 6 +- docs/authStrategies_LocalAuth.js.html | 6 +- docs/authStrategies_NoAuth.js.html | 6 +- docs/authStrategies_RemoteAuth.js.html | 6 +- docs/global.html | 533 +- docs/index.html | 255 +- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_Broadcast.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Channel.js.html | 436 + docs/structures_Chat.js.html | 12 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 18 +- docs/structures_GroupNotification.js.html | 6 +- docs/structures_Label.js.html | 6 +- docs/structures_List.js.html | 6 +- docs/structures_Location.js.html | 6 +- docs/structures_Message.js.html | 8 +- docs/structures_MessageMedia.js.html | 6 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.js.html | 6 +- docs/structures_Poll.js.html | 6 +- docs/structures_PollVote.js.html | 6 +- docs/structures_PrivateChat.js.html | 6 +- docs/structures_PrivateContact.js.html | 6 +- docs/structures_Product.js.html | 6 +- docs/structures_ProductMetadata.js.html | 6 +- docs/structures_Reaction.js.html | 6 +- docs/util_Constants.js.html | 6 +- docs/util_Injected_LegacyStore.js.html | 6 +- docs/util_Injected_Store.js.html | 45 +- docs/util_InterfaceController.js.html | 15 +- docs/util_Puppeteer.js.html | 6 +- docs/util_Util.js.html | 6 +- docs/webCache_LocalWebCache.js.html | 6 +- docs/webCache_RemoteWebCache.js.html | 6 +- docs/webCache_WebCache.js.html | 6 +- 75 files changed, 10151 insertions(+), 4115 deletions(-) create mode 100644 docs/Channel.html create mode 100644 docs/structures_Channel.js.html diff --git a/docs/Base.html b/docs/Base.html index 02fe450..314aa32 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Base + whatsapp-web.js 1.29.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 161bed9..d36d608 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.29.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/Broadcast.html b/docs/Broadcast.html index d71219c..873312f 100644 --- a/docs/Broadcast.html +++ b/docs/Broadcast.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Broadcast + whatsapp-web.js 1.29.0 » Class: Broadcast @@ -15,7 +15,7 @@ @@ -152,7 +152,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 368d242..755458e 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: BusinessContact + whatsapp-web.js 1.29.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index 95b727d..55c561b 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Buttons + whatsapp-web.js 1.29.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@ Returns: [{ buttonId:'customId',buttonText:{'displayText':&# diff --git a/docs/Call.html b/docs/Call.html index 52fdba0..acacf77 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Call + whatsapp-web.js 1.29.0 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@ diff --git a/docs/Channel.html b/docs/Channel.html new file mode 100644 index 0000000..9ebca0b --- /dev/null +++ b/docs/Channel.html @@ -0,0 +1,911 @@ + + + + + + + whatsapp-web.js 1.29.0 » Class: Channel + + + + + + + + +
+
+
+
+ +
+
+

Properties

+
+
+
+
description
+
+
+
id
+
+
+
isChannel
+
+
+
isGroup
+
+
+
+
+
+
+
isMuted
+
+
+
isReadOnly
+
+
+
lastMessage
+
+
+
muteExpiration
+
+
+
+
+
+
+
name
+
+
+
timestamp
+
+
+
unreadCount
+
+
+
+
+
+
+ +
+
+

new Channel()

+
+
Extends
+
Base
+
+
+
+

Properties

+
+

description +  string

+

The channel description

+
+
+

id +  ChannelId

+

ID that represents the channel

+
+
+

isChannel +  boolean

+

Indicates if it is a Channel

+
+
+

isGroup +  boolean

+

Indicates if it is a Group

+
+
+

isMuted +  boolean

+

Indicates if the channel is muted or not

+
+
+

isReadOnly +  boolean

+

Indicates if the channel is readonly

+
+
+

lastMessage +  Message

+

Last message in the channel

+
+
+

muteExpiration +  number

+

Unix timestamp for when the mute expires

+
+
+

name +  string

+

Title of the channel

+
+
+

timestamp +  number

+

Unix timestamp for when the last activity occurred

+
+
+

unreadCount +  number

+

Amount of messages unread

+
+
+
+

Methods

+
+
async
+

_muteUnmuteChannel(action) → Promise containing boolean

+

Internal method to mute or unmute the channel

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

action

+
+

string

+
+

 

+
+

The action: 'MUTE' or 'UNMUTE'

+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

_setChannelMetadata(value, property) → Promise containing boolean

+

Internal method to change the channel metadata

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

value

+
+

(string, number, or MessageMedia)

+
+

 

+
+

The new value to set

+
+

property

+
+

string

+
+

 

+
+

The property of a channel metadata to change

+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

acceptChannelAdminInvite() → Promise containing boolean

+

Accepts a channel admin invitation and promotes the current user to a channel admin

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

deleteChannel() → Promise containing boolean

+

Deletes the channel you created

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

demoteChannelAdmin(userId) → Promise containing boolean

+

Demotes a channel admin to a regular subscriber (can be used also for self-demotion)

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

userId

+
+

string

+
+

 

+
+

The user ID to demote

+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

fetchMessages(searchOptions) → Promise containing Array of Message

+

Loads channel messages, sorted from earliest to latest

+
+

Parameters

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

searchOptions

+
+

Object

+
+

 

+
+

Options for searching messages. Right now only limit and fromMe is supported

+

Values in searchOptions have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

limit

+
+

Number

+
+

Yes

+
+

The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages

+
+

fromMe

+
+

Boolean

+
+

Yes

+
+

Return only messages from the bot number or vise versa. To get all messages, leave the option undefined

+
+
+
+
+
Returns
+
+

Promise containing Array of Message 

+
+
+
async
+

getSubscribers(limit)

+

Gets the subscribers of the channel (only those who are in your contact list)

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

limit

+
+

number

+
+

 

+
+

Optional parameter to specify the limit of subscribers to retrieve

+

Value can be null.

+
+
+
+
Returns
+
+
+
async
+

mute() → Promise containing boolean

+

Mutes the channel

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

revokeChannelAdminInvite(userId) → Promise containing boolean

+

Revokes a channel admin invitation sent to a user by a channel owner

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

userId

+
+

string

+
+

 

+
+

The user ID the invitation was sent to

+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

sendChannelAdminInvite(chatId, options) → Promise containing boolean

+

Sends a channel admin invitation to a user, allowing them to become an admin of the channel

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

The ID of a user to send the channel admin invitation to

+
+

options

+
+

SendChannelAdminInviteOptions

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if an invitation was sent successfully, false otherwise

+

+
+
+
async
+

sendMessage(content, options) → Promise containing Message

+

Sends a message to this channel

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

content

+
+

(string or MessageMedia)

+
+

 

+
+
+

options

+
+

MessageSendOptions

+
+

 

+
+

Value can be null.

+
+
+
+
Returns
+
+

Promise containing Message  +

Message that was just sent

+

+
+
+
async
+

sendSeen() → Promise containing boolean

+

Sets the channel as seen

+
+
Returns
+
+

Promise containing boolean 

+
+
+
async
+

setDescription(newDescription) → Promise containing boolean

+

Updates the channel description

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

newDescription

+
+

string

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

setProfilePicture(newProfilePicture) → Promise containing boolean

+

Updates the channel profile picture

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

newProfilePicture

+
+

MessageMedia

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

setReactionSetting(reactionCode) → Promise containing boolean

+

Updates available reactions to use in the channel

+

Valid values for passing to the method are: + 0 for NONE reactions to be avaliable + 1 for BASIC reactions to be available: 👍, ❤️, 😂, 😮, 😢, 🙏 + 2 for ALL reactions to be available

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

reactionCode

+
+

number

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

setSubject(newSubject) → Promise containing boolean

+

Updates the channel subject

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

newSubject

+
+

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.

+

+
+
+
async
+

transferChannelOwnership(newOwnerId, options) → Promise containing boolean

+

Transfers a channel ownership to another user. + Note: the user you are transferring the channel ownership to must be a channel admin.

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

newOwnerId

+
+

string

+
+

 

+
+
+

options

+
+

TransferChannelOwnershipOptions

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
async
+

unmute() → Promise containing boolean

+

Unmutes the channel

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the operation completed successfully, false otherwise

+

+
+
+
+
+
+
+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/docs/Chat.html b/docs/Chat.html index c9e615d..10276e8 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Chat + whatsapp-web.js 1.29.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -270,12 +270,12 @@
async
-

clearMessages() → Promise containing Boolean

+

clearMessages() → Promise containing boolean

Clears all messages from the chat

Returns
-

Promise containing Boolean  +

Promise containing boolean 

result

@@ -502,7 +502,7 @@
async

sendSeen() → Promise containing Boolean

-

Set the chat as seen

+

Sets the chat as seen

Returns
@@ -567,7 +567,7 @@
diff --git a/docs/Client.html b/docs/Client.html index 9825f9e..caa4e29 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -1,3835 +1,7397 @@ - - - - - whatsapp-web.js 1.28.1-alpha.0 » Class: Client - - - - - - - - - \ No newline at end of file +
+
+
+
+ + + +
+ + + + + + + + +
+

Properties

+
+
+
+
info
+
+
+
+
+ +
+
+
pupBrowser
+
+
+
+
+ +
+
+
pupPage
+
+
+
+
+ +
+
+ + +
+

Methods

+
+ + + + + + +
+
+ + + + +
+

Events

+ +
+ +
+ + + +
+

new Client(options)

+ +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

options

+
+

 

+
+

 

+
+

Client options

+

Values in options have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

authStrategy

+
+

 

+
+

 

+
+

Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used.

+
+

webVersion

+
+

 

+
+

 

+
+

The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved.

+
+

webVersionCache

+
+

 

+
+

 

+
+

Determines how to retrieve the WhatsApp Web version. Defaults to a local cache (LocalWebCache) that falls back to latest if the requested version is not found.

+
+

authTimeoutMs

+
+

 

+
+

 

+
+

Timeout for authentication selector in puppeteer

+
+

puppeteer

+
+

 

+
+

 

+
+

Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/

+
+

qrMaxRetries

+
+

 

+
+

 

+
+

How many times should the qrcode be refreshed before giving up

+
+

restartOnAuthFail

+
+

 

+
+

 

+
+

@deprecated This option should be set directly on the LegacySessionAuth.

+
+

session

+
+

 

+
+

 

+
+

@deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly.

+
+

takeoverOnConflict

+
+

 

+
+

 

+
+

If another whatsapp web session is detected (another browser), take over the session in the current browser

+
+

takeoverTimeoutMs

+
+

 

+
+

 

+
+

How much time to wait before taking over the session

+
+

userAgent

+
+

 

+
+

 

+
+

User agent to use in puppeteer

+
+

ffmpegPath

+
+

 

+
+

 

+
+

Ffmpeg path to use when formatting videos to webp while sending stickers

+
+

bypassCSP

+
+

 

+
+

 

+
+

Sets bypassing of page's Content-Security-Policy.

+
+

proxyAuthentication

+
+

 

+
+

 

+
+

Proxy Authentication object.

+
+ +
+ +
+ + + +
+
Extends
+
EventEmitter
+ + + + + + + + + + + + + + + + +
Fires
+
Client#event:qr
+
Client#event:authenticated
+
Client#event:auth_failure
+
Client#event:ready
+
Client#event:message
+
Client#event:message_ack
+
Client#event:message_create
+
Client#event:message_revoke_me
+
Client#event:message_revoke_everyone
+
Client#event:message_ciphertext
+
Client#event:message_edit
+
Client#event:media_uploaded
+
Client#event:group_join
+
Client#event:group_leave
+
Client#event:group_update
+
Client#event:disconnected
+
Client#event:change_state
+
Client#event:contact_changed
+
Client#event:group_admin_changed
+
Client#event:group_membership_request
+
Client#event:vote_update
+ + + + + + + +
+ +
+ + +
+ + + + + + +

Properties

+
+

info +  ClientInfo

Current connection information

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

pupBrowser +  puppeteer.Browser

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

pupPage +  puppeteer.Page

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +

Methods

+
+
async

_muteUnmuteChat(chatId, action, unmuteDateTs) → Promise containing {isMuted: boolean, muteExpiration: number}

Internal method to mute or unmute the chat

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

ID of the chat that will be muted/unmuted

+
+

action

+
+

string

+
+

 

+
+

The action: 'MUTE' or 'UNMUTE'

+
+

unmuteDateTs

+
+

number

+
+

 

+
+

Timestamp at which the chat will be unmuted

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing {isMuted: boolean, muteExpiration: number} 

+ + + +
+ +
async

acceptChannelAdminInvite(channelId) → Promise containing boolean

Accepts a channel admin invitation and promotes the current user to a channel admin

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The channel ID to accept the admin invitation from

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

acceptGroupV4Invite(inviteInfo) → Promise containing Object

Accepts a private invitation to join a group

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

inviteInfo

+
+

object

+
+

 

+
+

Invite V4 Info

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Object 

+ + + +
+ +
async

acceptInvite(inviteCode) → Promise containing string

Accepts an invitation to join a group

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

inviteCode

+
+

string

+
+

 

+
+

Invitation code

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

Id of the joined Chat

+ + + +
+ +
async

addOrRemoveLabels(labelIds, chatIds) → Promise containing void

Change labels in chats

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

labelIds

+
+

Array of (number or string)

+
+

 

+
+
+

chatIds

+
+

Array of string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing void 

+ + + +
+ +
async

approveGroupMembershipRequests(groupId, options) → Promise containing Array of MembershipRequestActionResult

Approves membership requests if any

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

groupId

+
+

string

+
+

 

+
+

The group ID to get the membership request for

+
+

options

+
+

MembershipRequestActionOptions

+
+

 

+
+

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

+ + + +
+ +
async

archiveChat() → boolean

Enables and returns the archive state of the Chat

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

boolean 

+ + + +
+ +
async

attachEventListeners()

Attach event listeners to WA Web +Private function

+ + + +
+

Property

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

reinject

+
+

boolean

+
+

 

+
+

is this a reinject?

+
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

createChannel(title, options) → Promise containing (CreateChannelResult or string)

Creates a new channel

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

title

+
+

string

+
+

 

+
+

The channel name

+
+

options

+
+

CreateChannelOptions

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing (CreateChannelResult or string) 

Returns an object that handles the result for the channel creation or an error message as a string

+ + + +
+ +
async

createGroup(title, participants, options) → Promise containing (CreateGroupResult or string)

Creates a new group

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

title

+
+

string

+
+

 

+
+

Group title

+
+

participants

+
+

(string, Contact, Array of (Contact or string), or undefined)

+
+

 

+
+

A single Contact object or an ID as a string or an array of Contact objects or contact IDs to add to the group

+
+

options

+
+

CreateGroupOptions

+
+

 

+
+

An object that handles options for group creation

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing (CreateGroupResult or string) 

Object with resulting data or an error message as a string

+ + + +
+ +
async

deleteAddressbookContact(phoneNumber) → Promise containing void

Deletes the contact from user's addressbook

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

phoneNumber

+
+

string

+
+

 

+
+

The contact's phone number in a format "17182222222", where "1" is a country code

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing void 

+ + + +
+ +
async

deleteChannel(channelId) → Promise containing boolean

Deletes the channel you created

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The ID of a channel to delete

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

deleteProfilePicture() → Promise containing boolean

Deletes the current user's profile picture.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the picture was properly deleted.

+ + + +
+ +
async

demoteChannelAdmin(channelId, userId) → Promise containing boolean

Demotes a channel admin to a regular subscriber (can be used also for self-demotion)

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The channel ID to demote an admin in

+
+

userId

+
+

string

+
+

 

+
+

The user ID to demote

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

destroy()

Closes the client

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

getBlockedContacts() → Promise containing Array of Contact

Gets all blocked contacts by host account

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Contact 

+ + + +
+ +
async

getBroadcasts() → Promise containing Array of Broadcast

Get all current Broadcast

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Broadcast 

+ + + +
+ +
async

getChannelByInviteCode(inviteCode) → Promise containing Channel

Gets a Channel instance by invite code

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

inviteCode

+
+

string

+
+

 

+
+

The code that comes after the 'https://whatsapp.com/channel/'

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Channel 

+ + + +
+ +
async

getChannels() → Promise containing Array of Channel

Gets all cached Channel instance

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Channel 

+ + + +
+ +
async

getChatById(chatId) → Promise containing (Chat or Channel)

Gets chat or channel instance by ID

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing (Chat or Channel) 

+ + + +
+ +
async

getChatLabels(chatId) → Promise containing Array of Label

Get all Labels assigned to a chat

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Label 

+ + + +
+ +
async

getChats() → Promise containing Array of Chat

Get all current chat instances

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Chat 

+ + + +
+ +
async

getChatsByLabelId(labelId) → Promise containing Array of Chat

Get all Chats for a specific Label

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

labelId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Chat 

+ + + +
+ +
async

getCommonGroups(contactId) → Promise containing Array of WAWebJS.ChatId

Gets the Contact's common groups with you. Returns empty array if you don't have any common group.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

contactId

+
+

string

+
+

 

+
+

the whatsapp user's ID (_serialized format)

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of WAWebJS.ChatId 

+ + + +
+ +
async

getContactById(contactId) → Promise containing Contact

Get contact instance by ID

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

contactId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Contact 

+ + + +
+ +
async

getContactDeviceCount(userId) → Promise containing number

Get user device count by ID +Each WaWeb Connection counts as one device, and the phone (if exists) counts as one +So for a non-enterprise user with one WaWeb connection it should return "2"

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

userId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing number 

+ + + +
+ +
async

getContacts() → Promise containing Array of Contact

Get all current contact instances

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Contact 

+ + + +
+ +
async

getCountryCode(number) → Promise containing string

Get the country code of a WhatsApp ID.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

number

+
+

string

+
+

 

+
+

Number or ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

+ + + +
+ +
async

getFormattedNumber(number) → Promise containing string

Get the formatted number of a WhatsApp ID.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

number

+
+

string

+
+

 

+
+

Number or ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

+ + + +
+ +
async

getGroupMembershipRequests(groupId) → Promise containing Array of GroupMembershipRequest

Gets an array of membership requests

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

groupId

+
+

string

+
+

 

+
+

The ID of a group to get membership requests for

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of GroupMembershipRequest 

An array of membership requests

+ + + +
+ +
async

getInviteInfo(inviteCode) → Promise containing object

Returns an object with information about the invite code's group

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

inviteCode

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing object 

Invite information

+ + + +
+ +
async

getLabelById(labelId) → Promise containing Label

Get Label instance by ID

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

labelId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Label 

+ + + +
+ +
async

getLabels() → Promise containing Array of Label

Get all current Labels

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Label 

+ + + +
+ +
async

getNumberId(number) → Promise containing (Object or null)

Get the registered WhatsApp ID for a number. +Will return null if the number is not registered on WhatsApp.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

number

+
+

string

+
+

 

+
+

Number or ID ("@c.us" will be automatically appended if not specified)

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing (Object or null) 

+ + + +
+ +
async

getProfilePicUrl(contactId) → Promise containing string

Returns the contact ID's profile picture URL, if privacy settings allow it

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

contactId

+
+

string

+
+

 

+
+

the whatsapp user's ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

+ + + +
+ +
async

getState() → WAState

Gets the current connection state for the client

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

WAState 

+ + + +
+ +
async

getWWebVersion() → Promise containing string

Returns the version of WhatsApp Web currently being run

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

+ + + +
+ +
async

initialize()

Sets up events and requirements, kicks off authentication request

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

inject()

Injection logic +Private function

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

isRegisteredUser(id) → Promise containing Boolean

Check if a given ID is registered in whatsapp

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

id

+
+

string

+
+

 

+
+

the whatsapp user's ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Boolean 

+ + + +
+ +
async

logout()

Logs out the client, closing the current session

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

markChatUnread(chatId)

Mark the Chat as unread

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

ID of the chat that will be marked as unread

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

muteChat(chatId, unmuteDate) → Promise containing {isMuted: boolean, muteExpiration: number}

Mutes this chat forever, unless a date is specified

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

ID of the chat that will be muted

+
+

unmuteDate

+
+

Date

+
+

 

+
+

Date when the chat will be unmuted, don't provide a value to mute forever

+

Value can be null.

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing {isMuted: boolean, muteExpiration: number} 

+ + + +
+ +
async

pinChat() → Promise containing boolean

Pins the Chat

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

New pin state. Could be false if the max number of pinned chats was reached.

+ + + +
+ +
async

rejectGroupMembershipRequests(groupId, options) → Promise containing Array of MembershipRequestActionResult

Rejects membership requests if any

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

groupId

+
+

string

+
+

 

+
+

The group ID to get the membership request for

+
+

options

+
+

MembershipRequestActionOptions

+
+

 

+
+

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

+ + + +
+ +
async

requestPairingCode(phoneNumber, showNotification) → Promise containing string

Request authentication via pairing code instead of QR code

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

phoneNumber

+
+

string

+
+

 

+
+

Phone number in international, symbol-free format (e.g. 12025550108 for US, 551155501234 for Brazil)

+
+

showNotification

+
+

boolean

+
+

 

+
+

Show notification to pair on phone number

+

Defaults to true.

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

    +
  • Returns a pairing code in format "ABCDEFGH"
  • +
+ + + +
+ +
async

resetState()

Force reset of connection state for the client

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

revokeChannelAdminInvite(channelId, userId) → Promise containing boolean

Revokes a channel admin invitation sent to a user by a channel owner

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The channel ID an invitation belongs to

+
+

userId

+
+

string

+
+

 

+
+

The user ID the invitation was sent to

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

saveOrEditAddressbookContact(phoneNumber, firstName, lastName[, syncToAddressbook])

Save new contact to user's addressbook or edit the existing one

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

phoneNumber

+
+

string

+
+

 

+
+

The contact's phone number in a format "17182222222", where "1" is a country code

+
+

firstName

+
+

string

+
+

 

+
+
+

lastName

+
+

string

+
+

 

+
+
+

syncToAddressbook

+
+

boolean

+
+

Yes

+
+

If set to true, the contact will also be saved to the user's address book on their phone. False by default

+

Defaults to false.

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+
+ + + +
+ +
async

searchChannels(searchOptions)

Searches for channels based on search criteria, there are some notes:

+
    +
  1. The method finds only channels you are not subscribed to currently
  2. +
  3. If you have never been subscribed to a found channel +or you have unsubscribed from it with UnsubscribeOptions.deleteLocalModels set to 'true', +the lastMessage property of a found channel will be 'null'
  4. +
+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

searchOptions

+
+

Object

+
+

 

+
+

Search options

+

Values in searchOptions have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

searchText

+
+

string

+
+

Yes

+
+

Text to search

+

Defaults to ''.

+
+

countryCodes

+
+

Array of string

+
+

Yes

+
+

Array of country codes in 'ISO 3166-1 alpha-2' standart (@see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) to search for channels created in these countries

+

Defaults to [your local region].

+
+

skipSubscribedNewsletters

+
+

boolean

+
+

Yes

+
+

If true, channels that user is subscribed to won't appear in found channels

+

Defaults to false.

+
+

view

+
+

number

+
+

Yes

+
+

View type, makes sense only when the searchText is empty. Valid values to provide are: +0 for RECOMMENDED channels +1 for TRENDING channels +2 for POPULAR channels +3 for NEW channels

+

Defaults to 0.

+
+

limit

+
+

number

+
+

Yes

+
+

The limit of found channels to be appear in the returnig result

+

Defaults to 50.

+
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+
+ + + +
+ +
async

searchMessages(query[, options]) → Promise containing Array of Message

Searches for messages

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

query

+
+

string

+
+

 

+
+
+

options

+
+

Object

+
+

Yes

+
+

Values in options have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

page

+
+

number

+
+

Yes

+
+
+

limit

+
+

number

+
+

Yes

+
+
+

chatId

+
+

string

+
+

Yes

+
+
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of Message 

+ + + +
+ +
async

sendChannelAdminInvite(chatId, channelId, options) → Promise containing boolean

Sends a channel admin invitation to a user, allowing them to become an admin of the channel

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

The ID of a user to send the channel admin invitation to

+
+

channelId

+
+

string

+
+

 

+
+

The ID of a channel for which the invitation is being sent

+
+

options

+
+

SendChannelAdminInviteOptions

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if an invitation was sent successfully, false otherwise

+ + + +
+ +
async

sendMessage(chatId, content[, options]) → Promise containing Message

Send a message to a specific chatId

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+

content

+
+

(string, MessageMedia, Location, Poll, Contact, Array of Contact, Buttons, or List)

+
+

 

+
+
+

options

+
+

MessageSendOptions

+
+

Yes

+
+

Options used when sending the message

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Message 

Message that was just sent

+ + + +
+ +
async

sendPresenceAvailable()

Marks the client as online

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

sendPresenceUnavailable()

Marks the client as unavailable

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

sendSeen(chatId) → Promise containing boolean

Mark as seen for the Chat

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

result

+ + + +
+ +
async

setAutoDownloadAudio(flag)

Setting autoload download audio

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

flag

+
+

boolean

+
+

 

+
+

true/false

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

setAutoDownloadDocuments(flag)

Setting autoload download documents

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

flag

+
+

boolean

+
+

 

+
+

true/false

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

setAutoDownloadPhotos(flag)

Setting autoload download photos

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

flag

+
+

boolean

+
+

 

+
+

true/false

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

setAutoDownloadVideos(flag)

Setting autoload download videos

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

flag

+
+

boolean

+
+

 

+
+

true/false

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

setBackgroundSync(flag) → Promise containing boolean

Setting background synchronization. +NOTE: this action will take effect after you restart the client.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

flag

+
+

boolean

+
+

 

+
+

true/false

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

+ + + +
+ +
async

setDisplayName(displayName) → Promise containing Boolean

Sets the current user's display name. +This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

displayName

+
+

string

+
+

 

+
+

New display name

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Boolean 

+ + + +
+ +
async

setProfilePicture(media) → Promise containing boolean

Sets the current user's profile picture.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

media

+
+

MessageMedia

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the picture was properly updated.

+ + + +
+ +
async

setStatus(status)

Sets the current user's status message

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

status

+
+

string

+
+

 

+
+

New status message

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
async

subscribeToChannel(channelId) → Promise containing boolean

Subscribe to channel

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The channel ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

syncHistory(chatId) → Promise containing boolean

Sync chat history conversation

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

True if operation completed successfully, false otherwise.

+ + + +
+ +
async

transferChannelOwnership(channelId, newOwnerId, options) → Promise containing boolean

Transfers a channel ownership to another user. +Note: the user you are transferring the channel ownership to must be a channel admin.

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+
+

newOwnerId

+
+

string

+
+

 

+
+
+

options

+
+

TransferChannelOwnershipOptions

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
async

unarchiveChat() → boolean

Changes and returns the archive state of the Chat

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

boolean 

+ + + +
+ +
async

unmuteChat(chatId) → Promise containing {isMuted: boolean, muteExpiration: number}

Unmutes the Chat

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

ID of the chat that will be unmuted

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing {isMuted: boolean, muteExpiration: number} 

+ + + +
+ +
async

unpinChat() → Promise containing boolean

Unpins the Chat

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

New pin state

+ + + +
+ +
async

unsubscribeFromChannel(channelId, options) → Promise containing boolean

Unsubscribe from channel

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

channelId

+
+

string

+
+

 

+
+

The channel ID

+
+

options

+
+

UnsubscribeOptions

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

Returns true if the operation completed successfully, false otherwise

+ + + +
+ +
+ + + + +

Events

+
+

auth_failure

Emitted when there has been an error while trying to restore an existing session

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

authenticated

Emitted when authentication is successful

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

change_battery

Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

batteryInfo

+
+

object

+
+

 

+
+

Values in batteryInfo have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

battery

+
+

number

+
+

 

+
+

The current battery percentage

+
+

plugged

+
+

boolean

+
+

 

+
+

Indicates if the phone is plugged in (true) or not (false)

+
+ +
+ +
+ + + +
+ + + + + + + +
Deprecated
+
+ + + + + + + + + + + + + + + + +
+ +

change_state

Emitted when the connection state changes

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

state

+
+

WAState

+
+

 

+
+

the new connection state

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

chat_archived

Emitted when a chat is archived/unarchived

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chat

+
+

Chat

+
+

 

+
+
+

currState

+
+

boolean

+
+

 

+
+
+

prevState

+
+

boolean

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

chat_removed

Emitted when a chat is removed

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chat

+
+

Chat

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

contact_changed

Emitted when a contact or a group participant changes their phone number.

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

Message with more information about the event.

+
+

oldId

+
+

String

+
+

 

+
+

The user's id (an old one) who changed their phone number +and who triggered the notification.

+
+

newId

+
+

String

+
+

 

+
+

The user's new id after the change.

+
+

isContact

+
+

Boolean

+
+

 

+
+

Indicates if a contact or a group participant changed their phone number.

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

disconnected

Emitted when the client has been disconnected

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

reason

+
+

(WAState or "LOGOUT")

+
+

 

+
+

reason that caused the disconnect

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

group_admin_changed

Emitted when a current user is promoted to an admin or demoted to a regular user.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

group_join

Emitted when a user joins the chat via invite link or is added by an admin.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

group_leave

Emitted when a user leaves the chat or is removed by an admin.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

group_membership_request

Emitted when some user requested to join the group +that has the membership approval mode turned on

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+

Values in notification have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

The group ID the request was made for

+
+

author

+
+

string

+
+

 

+
+

The user ID that made a request

+
+

timestamp

+
+

number

+
+

 

+
+

The timestamp the request was made at

+
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

group_update

Emitted when group settings are updated, such as subject, description or picture.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

incoming_call

Emitted when a call is received

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

call

+
+

object

+
+

 

+
+

Values in call have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

id

+
+

number

+
+

 

+
+

Call id

+
+

peerJid

+
+

string

+
+

 

+
+

Who called

+
+

isVideo

+
+

boolean

+
+

 

+
+

if is video

+
+

isGroup

+
+

boolean

+
+

 

+
+

if is group

+
+

canHandleLocally

+
+

boolean

+
+

 

+
+

if we can handle in waweb

+
+

outgoing

+
+

boolean

+
+

 

+
+

if is outgoing

+
+

webClientShouldHandle

+
+

boolean

+
+

 

+
+

If Waweb should handle

+
+

participants

+
+

object

+
+

 

+
+

Participants

+
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

media_uploaded

Emitted when media has been uploaded for a message sent by the client.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message with media that was uploaded

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message

Emitted when a new message is received.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message that was received

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_ack

Emitted when an ack event occurrs on message type.

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message that was affected

+
+

ack

+
+

MessageAck

+
+

 

+
+

The new ACK value

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_ciphertext

Emitted when messages are edited

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_create

Emitted when a new message is created, which may include the current user's own messages.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message that was created

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_edit

Emitted when messages are edited

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+
+

newBody

+
+

string

+
+

 

+
+
+

prevBody

+
+

string

+
+

 

+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_reaction

Emitted when a reaction is sent, received, updated or removed

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

reaction

+
+

object

+
+

 

+
+

Values in reaction have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

id

+
+

object

+
+

 

+
+

Reaction id

+
+

orphan

+
+

number

+
+

 

+
+

Orphan

+
+

orphanReason

+
+

string

+
+

 

+
+

Orphan reason

+

Value can be null.

+
+

timestamp

+
+

number

+
+

 

+
+

Timestamp

+
+

reaction

+
+

string

+
+

 

+
+

Reaction

+
+

read

+
+

boolean

+
+

 

+
+

Read

+
+

msgId

+
+

object

+
+

 

+
+

Parent message id

+
+

senderId

+
+

string

+
+

 

+
+

Sender id

+
+

ack

+
+

number

+
+

 

+
+

Ack

+

Value can be null.

+
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_revoke_everyone

Emitted when a message is deleted for everyone in the chat.

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message that was revoked, in its current state. It will not contain the original message's data.

+
+

revoked_msg

+
+

Message

+
+

 

+
+

The message that was revoked, before it was revoked. It will contain the message's original data. +Note that due to the way this data is captured, it may be possible that this param will be undefined.

+

Value can be null.

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

message_revoke_me

Emitted when a message is deleted by the current user.

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

message

+
+

Message

+
+

 

+
+

The message that was revoked

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

qr

Emitted when a QR code is received

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

qr

+
+

string

+
+

 

+
+

QR Code

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

ready

Emitted when the client has initialized and is ready to receive messages.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +

vote_update

Emitted when some poll option is selected or deselected, +shows a user's current selected option(s) on the poll

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ +
+
+
+ +
+ + + + + + + + diff --git a/docs/Client.js.html b/docs/Client.js.html index 038e3d7..a3050d8 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: Client.js + whatsapp-web.js 1.29.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -46,7 +46,7 @@ const { LoadUtils } = require('./util/Injected/Utils'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); const WebCacheFactory = require('./webCache/WebCacheFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, Poll, PollVote, GroupNotification, Label, Call, Buttons, List, Reaction, Broadcast} = require('./structures'); +const { Broadcast, Buttons, Call, ClientInfo, Contact, GroupNotification, Label, List, Location, Message, MessageMedia, Poll, PollVote, Reaction } = require('./structures'); const NoAuth = require('./authStrategies/NoAuth'); const {exposeFunctionIfAbsent} = require('./util/Puppeteer'); @@ -851,11 +851,9 @@ class Client extends EventEmitter { * */ async sendSeen(chatId) { - const result = await this.pupPage.evaluate(async (chatId) => { + return await this.pupPage.evaluate(async (chatId) => { return window.WWebJS.sendSeen(chatId); - }, chatId); - return result; } /** @@ -885,6 +883,7 @@ class Client extends EventEmitter { * @property {string} [stickerName=undefined] - Sets the name of the sticker, (if sendMediaAsSticker is true). * @property {string[]} [stickerCategories=undefined] - Sets the categories of the sticker, (if sendMediaAsSticker is true). Provide emoji char array, can be null. * @property {MessageMedia} [media] - Media to be sent + * @property {any} [extra] - Extra options */ /** @@ -896,6 +895,19 @@ class Client extends EventEmitter { * @returns {Promise<Message>} Message that was just sent */ async sendMessage(chatId, content, options = {}) { + const isChannel = /@\w*newsletter\b/.test(chatId); + + if (isChannel && [ + options.sendMediaAsDocument, options.quotedMessageId, + options.parseVCards, options.isViewOnce, + content instanceof Location, content instanceof Contact, + content instanceof Buttons, content instanceof List, + Array.isArray(content) && content.length > 0 && content[0] instanceof Contact + ].includes(true)) { + console.warn('The message type is currently not supported for sending in channels,\nthe supported message types are: text, image, sticker, gif, video, voice and poll.'); + return null; + } + if (options.mentions) { !Array.isArray(options.mentions) && (options.mentions = [options.mentions]); if (options.mentions.some((possiblyContact) => possiblyContact instanceof Contact)) { @@ -905,7 +917,7 @@ class Client extends EventEmitter { } options.groupMentions && !Array.isArray(options.groupMentions) && (options.groupMentions = [options.groupMentions]); - + let internalOptions = { linkPreview: options.linkPreview === false ? undefined : true, sendAudioAsVoice: options.sendAudioAsVoice, @@ -921,14 +933,14 @@ class Client extends EventEmitter { extraOptions: options.extra }; - const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen; + const sendSeen = options.sendSeen !== false; if (content instanceof MessageMedia) { - internalOptions.attachment = content; + internalOptions.media = content; internalOptions.isViewOnce = options.isViewOnce, content = ''; } else if (options.media instanceof MessageMedia) { - internalOptions.attachment = options.media; + internalOptions.media = options.media; internalOptions.caption = content; internalOptions.isViewOnce = options.isViewOnce, content = ''; @@ -945,17 +957,19 @@ class Client extends EventEmitter { internalOptions.contactCardList = content.map(contact => contact.id._serialized); content = ''; } else if (content instanceof Buttons) { + console.warn('Buttons are now deprecated. See more at https://www.youtube.com/watch?v=hv1R1rLeVVE.'); if (content.type !== 'chat') { internalOptions.attachment = content.body; } internalOptions.buttons = content; content = ''; } else if (content instanceof List) { + console.warn('Lists are now deprecated. See more at https://www.youtube.com/watch?v=hv1R1rLeVVE.'); internalOptions.list = content; content = ''; } - if (internalOptions.sendMediaAsSticker && internalOptions.attachment) { - internalOptions.attachment = await Util.formatToWebpSticker( - internalOptions.attachment, { + if (internalOptions.sendMediaAsSticker && internalOptions.media) { + internalOptions.media = await Util.formatToWebpSticker( + internalOptions.media, { name: options.stickerName, author: options.stickerAuthor, categories: options.stickerCategories @@ -963,20 +977,60 @@ class Client extends EventEmitter { ); } - const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = await window.Store.Chat.find(chatWid); + const sentMsg = await this.pupPage.evaluate(async (chatId, content, options, sendSeen) => { + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); + if (!chat) return null; if (sendSeen) { await window.WWebJS.sendSeen(chatId); } - const msg = await window.WWebJS.sendMessage(chat, message, options, sendSeen); - return window.WWebJS.getMessageModel(msg); + const msg = await window.WWebJS.sendMessage(chat, content, options); + return msg + ? window.WWebJS.getMessageModel(msg) + : undefined; }, chatId, content, internalOptions, sendSeen); - return new Message(this, newMessage); + return sentMsg + ? new Message(this, sentMsg) + : undefined; + } + + /** + * @typedef {Object} SendChannelAdminInviteOptions + * @property {?string} comment The comment to be added to an invitation + */ + + /** + * Sends a channel admin invitation to a user, allowing them to become an admin of the channel + * @param {string} chatId The ID of a user to send the channel admin invitation to + * @param {string} channelId The ID of a channel for which the invitation is being sent + * @param {SendChannelAdminInviteOptions} options + * @returns {Promise<boolean>} Returns true if an invitation was sent successfully, false otherwise + */ + async sendChannelAdminInvite(chatId, channelId, options = {}) { + const response = await this.pupPage.evaluate(async (chatId, channelId, options) => { + const channelWid = window.Store.WidFactory.createWid(channelId); + const chatWid = window.Store.WidFactory.createWid(chatId); + const chat = window.Store.Chat.get(chatWid) || (await window.Store.Chat.find(chatWid)); + + if (!chatWid.isUser()) { + return false; + } + + return await window.Store.SendChannelMessage.sendNewsletterAdminInviteMessage( + chat, + { + newsletterWid: channelWid, + invitee: chatWid, + inviteMessage: options.comment, + base64Thumb: await window.WWebJS.getProfilePicThumbToBase64(channelWid) + } + ); + }, chatId, channelId, options); + + return response.messageSendResult === 'OK'; } /** @@ -1002,7 +1056,7 @@ class Client extends EventEmitter { * @returns {Promise<Array<Chat>>} */ async getChats() { - let chats = await this.pupPage.evaluate(async () => { + const chats = await this.pupPage.evaluate(async () => { return await window.WWebJS.getChats(); }); @@ -1010,16 +1064,51 @@ class Client extends EventEmitter { } /** - * Get chat instance by ID + * Gets all cached {@link Channel} instance + * @returns {Promise<Array<Channel>>} + */ + async getChannels() { + const channels = await this.pupPage.evaluate(async () => { + return await window.WWebJS.getChannels(); + }); + + return channels.map((channel) => ChatFactory.create(this, channel)); + } + + /** + * Gets chat or channel instance by ID * @param {string} chatId - * @returns {Promise<Chat>} + * @returns {Promise<Chat|Channel>} */ async getChatById(chatId) { - let chat = await this.pupPage.evaluate(async chatId => { + const chat = await this.pupPage.evaluate(async chatId => { return await window.WWebJS.getChat(chatId); }, chatId); + return chat + ? ChatFactory.create(this, chat) + : undefined; + } - return ChatFactory.create(this, chat); + /** + * Gets a {@link Channel} instance by invite code + * @param {string} inviteCode The code that comes after the 'https://whatsapp.com/channel/' + * @returns {Promise<Channel>} + */ + async getChannelByInviteCode(inviteCode) { + const channel = await this.pupPage.evaluate(async (inviteCode) => { + let channelMetadata; + try { + channelMetadata = await window.WWebJS.getChannelMetadata(inviteCode); + } catch (err) { + if (err.name === 'ServerStatusCodeError') return null; + throw err; + } + return await window.WWebJS.getChat(channelMetadata.id); + }, inviteCode); + + return channel + ? ChatFactory.create(this, channel) + : undefined; } /** @@ -1089,6 +1178,61 @@ class Client extends EventEmitter { return res.gid._serialized; } + /** + * Accepts a channel admin invitation and promotes the current user to a channel admin + * @param {string} channelId The channel ID to accept the admin invitation from + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async acceptChannelAdminInvite(channelId) { + return await this.pupPage.evaluate(async (channelId) => { + try { + await window.Store.ChannelUtils.acceptNewsletterAdminInvite(channelId); + return true; + } catch (err) { + if (err.name === 'ServerStatusCodeError') return false; + throw err; + } + }, channelId); + } + + /** + * Revokes a channel admin invitation sent to a user by a channel owner + * @param {string} channelId The channel ID an invitation belongs to + * @param {string} userId The user ID the invitation was sent to + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async revokeChannelAdminInvite(channelId, userId) { + return await this.pupPage.evaluate(async (channelId, userId) => { + try { + const userWid = window.Store.WidFactory.createWid(userId); + await window.Store.ChannelUtils.revokeNewsletterAdminInvite(channelId, userWid); + return true; + } catch (err) { + if (err.name === 'ServerStatusCodeError') return false; + throw err; + } + }, channelId, userId); + } + + /** + * Demotes a channel admin to a regular subscriber (can be used also for self-demotion) + * @param {string} channelId The channel ID to demote an admin in + * @param {string} userId The user ID to demote + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async demoteChannelAdmin(channelId, userId) { + return await this.pupPage.evaluate(async (channelId, userId) => { + try { + const userWid = window.Store.WidFactory.createWid(userId); + await window.Store.ChannelUtils.demoteNewsletterAdmin(channelId, userWid); + return true; + } catch (err) { + if (err.name === 'ServerStatusCodeError') return false; + throw err; + } + }, channelId, userId); + } + /** * Accepts a private invitation to join a group * @param {object} inviteInfo Invite V4 Info @@ -1165,7 +1309,7 @@ class Client extends EventEmitter { */ async archiveChat(chatId) { return await this.pupPage.evaluate(async chatId => { - let chat = await window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.archiveChat(chat, true); return true; }, chatId); @@ -1177,7 +1321,7 @@ class Client extends EventEmitter { */ async unarchiveChat(chatId) { return await this.pupPage.evaluate(async chatId => { - let chat = await window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.archiveChat(chat, false); return false; }, chatId); @@ -1189,7 +1333,7 @@ class Client extends EventEmitter { */ async pinChat(chatId) { return this.pupPage.evaluate(async chatId => { - let chat = window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); if (chat.pin) { return true; } @@ -1212,7 +1356,7 @@ class Client extends EventEmitter { */ async unpinChat(chatId) { return this.pupPage.evaluate(async chatId => { - let chat = window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); if (!chat.pin) { return false; } @@ -1264,7 +1408,7 @@ class Client extends EventEmitter { */ async markChatUnread(chatId) { await this.pupPage.evaluate(async chatId => { - let chat = await window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.markChatUnread(chat, true); }, chatId); } @@ -1466,7 +1610,7 @@ class Client extends EventEmitter { for (const participant of createGroupResult.participants) { let isInviteV4Sent = false; const participantId = participant.wid._serialized; - const statusCode = participant.error ?? 200; + const statusCode = participant.error || 200; if (autoSendInviteV4 && statusCode === 403) { window.Store.Contact.gadd(participant.wid, { silent: true }); @@ -1505,6 +1649,219 @@ class Client extends EventEmitter { }, title, participants, options); } + /** + * An object that handles the result for {@link createChannel} method + * @typedef {Object} CreateChannelResult + * @property {string} title A channel title + * @property {ChatId} nid An object that handels the newly created channel ID + * @property {string} nid.server 'newsletter' + * @property {string} nid.user 'XXXXXXXXXX' + * @property {string} nid._serialized 'XXXXXXXXXX@newsletter' + * @property {string} inviteLink The channel invite link, starts with 'https://whatsapp.com/channel/' + * @property {number} createdAtTs The timestamp the channel was created at + */ + + /** + * Options for the channel creation + * @typedef {Object} CreateChannelOptions + * @property {?string} description The channel description + * @property {?MessageMedia} picture The channel profile picture + */ + + /** + * Creates a new channel + * @param {string} title The channel name + * @param {CreateChannelOptions} options + * @returns {Promise<CreateChannelResult|string>} Returns an object that handles the result for the channel creation or an error message as a string + */ + async createChannel(title, options = {}) { + return await this.pupPage.evaluate(async (title, options) => { + let response, { description = null, picture = null } = options; + + if (!window.Store.ChannelUtils.isNewsletterCreationEnabled()) { + return 'CreateChannelError: A channel creation is not enabled'; + } + + if (picture) { + picture = await window.WWebJS.cropAndResizeImage(picture, { + asDataUrl: true, + mimetype: 'image/jpeg', + size: 640, + quality: 1 + }); + } + + try { + response = await window.Store.ChannelUtils.createNewsletterQuery({ + name: title, + description: description, + picture: picture, + }); + } catch (err) { + if (err.name === 'ServerStatusCodeError') { + return 'CreateChannelError: An error occupied while creating a channel'; + } + throw err; + } + + return { + title: title, + nid: window.Store.JidToWid.newsletterJidToWid(response.idJid), + inviteLink: `https://whatsapp.com/channel/${response.newsletterInviteLinkMetadataMixin.inviteCode}`, + createdAtTs: response.newsletterCreationTimeMetadataMixin.creationTimeValue + }; + }, title, options); + } + + /** + * Subscribe to channel + * @param {string} channelId The channel ID + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async subscribeToChannel(channelId) { + return await this.pupPage.evaluate(async (channelId) => { + return await window.WWebJS.subscribeToUnsubscribeFromChannel(channelId, 'Subscribe'); + }, channelId); + } + + /** + * Options for unsubscribe from a channel + * @typedef {Object} UnsubscribeOptions + * @property {boolean} [deleteLocalModels = false] If true, after an unsubscription, it will completely remove a channel from the channel collection making it seem like the current user have never interacted with it. Otherwise it will only remove a channel from the list of channels the current user is subscribed to and will set the membership type for that channel to GUEST + */ + + /** + * Unsubscribe from channel + * @param {string} channelId The channel ID + * @param {UnsubscribeOptions} options + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async unsubscribeFromChannel(channelId, options) { + return await this.pupPage.evaluate(async (channelId, options) => { + return await window.WWebJS.subscribeToUnsubscribeFromChannel(channelId, 'Unsubscribe', options); + }, channelId, options); + } + + /** + * Options for transferring a channel ownership to another user + * @typedef {Object} TransferChannelOwnershipOptions + * @property {boolean} [shouldDismissSelfAsAdmin = false] If true, after the channel ownership is being transferred to another user, the current user will be dismissed as a channel admin and will become to a channel subscriber. + */ + + /** + * Transfers a channel ownership to another user. + * Note: the user you are transferring the channel ownership to must be a channel admin. + * @param {string} channelId + * @param {string} newOwnerId + * @param {TransferChannelOwnershipOptions} options + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async transferChannelOwnership(channelId, newOwnerId, options = {}) { + return await this.pupPage.evaluate(async (channelId, newOwnerId, options) => { + const channel = await window.WWebJS.getChat(channelId, { getAsModel: false }); + const newOwner = window.Store.Contact.get(newOwnerId) || (await window.Store.Contact.find(newOwnerId)); + if (!channel.newsletterMetadata) { + await window.Store.NewsletterMetadataCollection.update(channel.id); + } + + try { + await window.Store.ChannelUtils.changeNewsletterOwnerAction(channel, newOwner); + + if (options.shouldDismissSelfAsAdmin) { + const meContact = window.Store.ContactCollection.getMeContact(); + meContact && (await window.Store.ChannelUtils.demoteNewsletterAdminAction(channel, meContact)); + } + } catch (error) { + return false; + } + + return true; + }, channelId, newOwnerId, options); + } + + /** + * Searches for channels based on search criteria, there are some notes: + * 1. The method finds only channels you are not subscribed to currently + * 2. If you have never been subscribed to a found channel + * or you have unsubscribed from it with {@link UnsubscribeOptions.deleteLocalModels} set to 'true', + * the lastMessage property of a found channel will be 'null' + * + * @param {Object} searchOptions Search options + * @param {string} [searchOptions.searchText = ''] Text to search + * @param {Array<string>} [searchOptions.countryCodes = [your local region]] Array of country codes in 'ISO 3166-1 alpha-2' standart (@see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) to search for channels created in these countries + * @param {boolean} [searchOptions.skipSubscribedNewsletters = false] If true, channels that user is subscribed to won't appear in found channels + * @param {number} [searchOptions.view = 0] View type, makes sense only when the searchText is empty. Valid values to provide are: + * 0 for RECOMMENDED channels + * 1 for TRENDING channels + * 2 for POPULAR channels + * 3 for NEW channels + * @param {number} [searchOptions.limit = 50] The limit of found channels to be appear in the returnig result + * @returns {Promise<Array<Channel>|[]>} Returns an array of Channel objects or an empty array if no channels were found + */ + async searchChannels(searchOptions = {}) { + return await this.pupPage.evaluate(async ({ + searchText = '', + countryCodes = [window.Store.ChannelUtils.currentRegion], + skipSubscribedNewsletters = false, + view = 0, + limit = 50 + }) => { + searchText = searchText.trim(); + const currentRegion = window.Store.ChannelUtils.currentRegion; + if (![0, 1, 2, 3].includes(view)) view = 0; + + countryCodes = countryCodes.length === 1 && countryCodes[0] === currentRegion + ? countryCodes + : countryCodes.filter((code) => Object.keys(window.Store.ChannelUtils.countryCodesIso).includes(code)); + + const viewTypeMapping = { + 0: 'RECOMMENDED', + 1: 'TRENDING', + 2: 'POPULAR', + 3: 'NEW' + }; + + searchOptions = { + searchText: searchText, + countryCodes: countryCodes, + skipSubscribedNewsletters: skipSubscribedNewsletters, + view: viewTypeMapping[view], + categories: [], + cursorToken: '' + }; + + const originalFunction = window.Store.ChannelUtils.getNewsletterDirectoryPageSize; + limit !== 50 && (window.Store.ChannelUtils.getNewsletterDirectoryPageSize = () => limit); + + const channels = (await window.Store.ChannelUtils.fetchNewsletterDirectories(searchOptions)).newsletters; + + limit !== 50 && (window.Store.ChannelUtils.getNewsletterDirectoryPageSize = originalFunction); + + return channels + ? await Promise.all(channels.map((channel) => window.WWebJS.getChatModel(channel, { isChannel: true }))) + : []; + }, searchOptions); + } + + /** + * Deletes the channel you created + * @param {string} channelId The ID of a channel to delete + * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise + */ + async deleteChannel(channelId) { + return await this.client.pupPage.evaluate(async (channelId) => { + const channel = await window.WWebJS.getChat(channelId, { getAsModel: false }); + if (!channel) return false; + try { + await window.Store.ChannelUtils.deleteNewsletterAction(channel); + return true; + } catch (err) { + if (err.name === 'ServerStatusCodeError') return false; + throw err; + } + }, channelId); + } + /** * Get all current Labels * @returns {Promise<Array<Label>>} @@ -1863,7 +2220,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 069dcbc..b50dd6c 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: ClientInfo + whatsapp-web.js 1.29.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html index d82e377..859f078 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Contact + whatsapp-web.js 1.29.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 0d8cfbe..10d3bca 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: GroupChat + whatsapp-web.js 1.29.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -470,7 +470,7 @@
async
-

clearMessages() → Promise containing Boolean

+

clearMessages() → Promise containing boolean

Clears all messages from the chat

Inherited from
@@ -914,7 +914,7 @@
async

sendSeen() → Promise containing Boolean

-

Set the chat as seen

+

Sets the chat as seen

Inherited from
Chat#sendSeen
@@ -1225,7 +1225,7 @@
diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index eb950da..424ebd7 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: GroupNotification + whatsapp-web.js 1.29.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@
diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 6c23bc9..100e7ca 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: InterfaceController + whatsapp-web.js 1.29.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@
diff --git a/docs/Label.html b/docs/Label.html index 2c4aef7..ef87ad1 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Label + whatsapp-web.js 1.29.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@
diff --git a/docs/List.html b/docs/List.html index 7bb5bf5..94c6648 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: List + whatsapp-web.js 1.29.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@ Returns: [{'title':'sectionTitle','rows':[{'r
diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 0d0521f..19c9b29 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: LocalAuth + whatsapp-web.js 1.29.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -134,7 +134,7 @@
diff --git a/docs/LocalWebCache.html b/docs/LocalWebCache.html index 2f96226..c66afb6 100644 --- a/docs/LocalWebCache.html +++ b/docs/LocalWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: LocalWebCache + whatsapp-web.js 1.29.0 » Class: LocalWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/Location.html b/docs/Location.html index 9e2fc00..97c31db 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Location + whatsapp-web.js 1.29.0 » Class: Location @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@
diff --git a/docs/Message.html b/docs/Message.html index 31aab63..5db8ffb 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Message + whatsapp-web.js 1.29.0 » Class: Message @@ -15,7 +15,7 @@ @@ -815,7 +815,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 55d7357..11f54bf 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: MessageMedia + whatsapp-web.js 1.29.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@
diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 54df7ce..333e7b3 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: NoAuth + whatsapp-web.js 1.29.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@
diff --git a/docs/Order.html b/docs/Order.html index a2d769b..854c5f7 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Order + whatsapp-web.js 1.29.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@
diff --git a/docs/Poll.html b/docs/Poll.html index d547d62..5b93517 100644 --- a/docs/Poll.html +++ b/docs/Poll.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Poll + whatsapp-web.js 1.29.0 » Class: Poll @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@
diff --git a/docs/PollVote.html b/docs/PollVote.html index 9639652..b4417a9 100644 --- a/docs/PollVote.html +++ b/docs/PollVote.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: PollVote + whatsapp-web.js 1.29.0 » Class: PollVote @@ -15,7 +15,7 @@ @@ -104,7 +104,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index f7e0b9e..bd21961 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: PrivateChat + whatsapp-web.js 1.29.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -294,7 +294,7 @@
async
-

clearMessages() → Promise containing Boolean

+

clearMessages() → Promise containing boolean

Clears all messages from the chat

Inherited from
@@ -530,7 +530,7 @@
async

sendSeen() → Promise containing Boolean

-

Set the chat as seen

+

Sets the chat as seen

Inherited from
Chat#sendSeen
@@ -601,7 +601,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index a3c56a4..04d8fa8 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: PrivateContact + whatsapp-web.js 1.29.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@
diff --git a/docs/Product.html b/docs/Product.html index bca325d..67191e5 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Product + whatsapp-web.js 1.29.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@
diff --git a/docs/Reaction.html b/docs/Reaction.html index 65e3693..6965fbf 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Reaction + whatsapp-web.js 1.29.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@
diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 15eb227..0892a44 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: RemoteAuth + whatsapp-web.js 1.29.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -162,7 +162,7 @@
diff --git a/docs/RemoteWebCache.html b/docs/RemoteWebCache.html index 28a498f..3505015 100644 --- a/docs/RemoteWebCache.html +++ b/docs/RemoteWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: RemoteWebCache + whatsapp-web.js 1.29.0 » Class: RemoteWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/Util.html b/docs/Util.html index 3e06b0a..dbd4bb1 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: Util + whatsapp-web.js 1.29.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@
diff --git a/docs/WebCache.html b/docs/WebCache.html index 189b3df..825b4b0 100644 --- a/docs/WebCache.html +++ b/docs/WebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Class: WebCache + whatsapp-web.js 1.29.0 » Class: WebCache @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@
diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index df78539..ac81c7f 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.29.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@ module.exports = BaseAuthStrategy;
diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index db9eb43..523c0ef 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.29.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -97,7 +97,7 @@ module.exports = LocalAuth;
diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 554e705..f3ea99a 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.29.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ module.exports = NoAuth;
diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 27b54ac..9c57bdf 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.29.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -249,7 +249,7 @@ module.exports = RemoteAuth;
diff --git a/docs/global.html b/docs/global.html index 2549b8e..af47a5d 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Globals + whatsapp-web.js 1.29.0 » Globals @@ -15,7 +15,7 @@ @@ -93,9 +93,18 @@
ButtonSpec
+
ChannelId
+
+
ContactId
+
CreateChannelOptions
+
+
+
CreateChannelResult
+
+
CreateGroupOptions
@@ -142,16 +151,19 @@
Mention
-
- -
-
MessageInfo
MessageSendOptions
+
MessageSendOptions
+
+
+
+
+
+
ParticipantResult
@@ -164,6 +176,12 @@
SelectedPollOption
+
SendChannelAdminInviteOptions
+
+
+
SendChannelAdminInviteOptions
+
+
StickerMetadata
@@ -173,6 +191,15 @@
TargetOptions
+
TransferChannelOwnershipOptions
+
+
+
TransferChannelOwnershipOptions
+
+
+
UnsubscribeOptions
+
+
@@ -1846,6 +1873,65 @@
+

ChannelId +  Object

+

Channel ID structure

+
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

server

+
+

string

+
+

 

+
+
+

user

+
+

string

+
+

 

+
+
+

_serialized

+
+

string

+
+

 

+
+
+
+
+

ContactId  Object

ID that represents a contact

@@ -1905,6 +1991,187 @@
+

CreateChannelOptions +  Object

+

Options for the channel creation

+
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

description

+
+

string

+
+

 

+
+

The channel description

+

Value can be null.

+
+

picture

+
+

MessageMedia

+
+

 

+
+

The channel profile picture

+

Value can be null.

+
+
+
+
+

CreateChannelResult +  Object

+

An object that handles the result for createChannel method

+
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

title

+
+

string

+
+

 

+
+

A channel title

+
+

nid

+
+

ChatId

+
+

 

+
+

An object that handels the newly created channel ID

+

Values in nid have the following properties:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

server

+
+

string

+
+

 

+
+

'newsletter'

+
+

user

+
+

string

+
+

 

+
+

'XXXXXXXXXX'

+
+

_serialized

+
+

string

+
+

 

+
+

'XXXXXXXXXX@newsletter'

+
+
+

inviteLink

+
+

string

+
+

 

+
+

The channel invite link, starts with 'https://whatsapp.com/channel/'

+
+

createdAtTs

+
+

number

+
+

 

+
+

The timestamp the channel was created at

+
+
+
+

CreateGroupOptions  Object

An object that handles options for group creation

@@ -3261,6 +3528,85 @@

Media to be sent

+ + +

extra

+ + +

any

+ + +

Yes

+ + +

Extra options

+ + + + + +
+
+

MessageSendOptions +  Object

+

Message options

+
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

caption

+
+

string

+
+

 

+
+

Image or video caption

+

Value can be null.

+
+

mentions

+
+

Array of string

+
+

 

+
+

User IDs of user that will be mentioned in the message

+

Value can be null.

+
+

media

+
+

MessageMedia

+
+

 

+
+

Image or video to be sent

+

Value can be null.

+
@@ -3516,6 +3862,74 @@
+

SendChannelAdminInviteOptions +  Object

+
+

Property

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

comment

+
+

string

+
+

 

+
+

The comment to be added to an invitation

+

Value can be null.

+
+
+
+
+

SendChannelAdminInviteOptions +  Object

+
+

Property

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

comment

+
+

string

+
+

 

+
+

The comment to be added to an invitation

+

Value can be null.

+
+
+
+

StickerMetadata  Object

Sticker metadata.

@@ -3685,6 +4099,111 @@
+

TransferChannelOwnershipOptions +  Object

+

Options for transferring a channel ownership to another user

+
+

Property

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

shouldDismissSelfAsAdmin

+
+

boolean

+
+

Yes

+
+

If true, after the channel ownership is being transferred to another user, the current user will be dismissed as a channel admin and will become to a channel subscriber.

+

Defaults to false.

+
+
+
+
+

TransferChannelOwnershipOptions +  Object

+

Options for transferring a channel ownership to another user

+
+

Property

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

shouldDismissSelfAsAdmin

+
+

boolean

+
+

Yes

+
+

If true, after the channel ownership is being transferred to another user, the current user will be dismissed as a channel admin and will become to a channel subscriber.

+

Defaults to false.

+
+
+
+
+

UnsubscribeOptions +  Object

+

Options for unsubscribe from a channel

+
+

Property

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

deleteLocalModels

+
+

boolean

+
+

Yes

+
+

If true, after an unsubscription, it will completely remove a channel from the channel collection making it seem like the current user have never interacted with it. Otherwise it will only remove a channel from the list of channels the current user is subscribed to and will set the membership type for that channel to GUEST

+

Defaults to false.

+
+
+
+
@@ -3695,7 +4214,7 @@ diff --git a/docs/index.html b/docs/index.html index 92dbfd9..1ca52df 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Home + whatsapp-web.js 1.29.0 » Home @@ -13,7 +13,7 @@ @@ -26,7 +26,7 @@
@@ -653,6 +653,178 @@ limitations under the License.

+
+ +

Chat

@@ -883,6 +1055,11 @@ limitations under the License.

+
+ Client#acceptChannelAdminInvite(channelId) +
+
+
Client#acceptGroupV4Invite(inviteInfo)
@@ -913,6 +1090,11 @@ limitations under the License.

+
+ Client#createChannel(title, options) +
+
+
Client#createGroup(title, participants, options)
@@ -923,11 +1105,21 @@ limitations under the License.

+
+ Client#deleteChannel(channelId) +
+
+
Client#deleteProfilePicture()
+
+ Client#demoteChannelAdmin(channelId, userId) +
+
+
Client#destroy()
@@ -1078,6 +1270,16 @@ limitations under the License.

+
+ Client#getChannelByInviteCode(inviteCode) +
+
+
+
+ Client#getChannels() +
+
+
Client#getChatById(chatId)
@@ -1178,11 +1380,6 @@ limitations under the License.

- -
- -
-
Client#inject()
@@ -1193,6 +1390,11 @@ limitations under the License.

+
+
+ + @@ -3994,11 +4226,6 @@ limitations under the License.

@@ -4015,7 +4242,7 @@ limitations under the License.

diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js index f35ad9d..2943fdc 100644 --- a/docs/scripts/jsdoc-toc.js +++ b/docs/scripts/jsdoc-toc.js @@ -6,7 +6,7 @@ treeNode.tree({ autoEscape: false, closedIcon: '⇢', - data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"Broadcast","id":"Broadcast","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], + data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"Broadcast","id":"Broadcast","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Channel","id":"Channel","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], openedIcon: ' ⇣', saveState: false, useContextMenu: false diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index a016ca2..a6b0d8e 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Base.js + whatsapp-web.js 1.29.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@ module.exports = Base;
diff --git a/docs/structures_Broadcast.js.html b/docs/structures_Broadcast.js.html index 4e93862..5a19fec 100644 --- a/docs/structures_Broadcast.js.html +++ b/docs/structures_Broadcast.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Broadcast.js + whatsapp-web.js 1.29.0 » Source: structures/Broadcast.js @@ -15,7 +15,7 @@ @@ -108,7 +108,7 @@ module.exports = Broadcast;
diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index cece228..7ce0efb 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.29.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 7a423c4..e5db1e6 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Buttons.js + whatsapp-web.js 1.29.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 1c38751..ebfe6ea 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Call.js + whatsapp-web.js 1.29.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@ module.exports = Call;
diff --git a/docs/structures_Channel.js.html b/docs/structures_Channel.js.html new file mode 100644 index 0000000..f59654c --- /dev/null +++ b/docs/structures_Channel.js.html @@ -0,0 +1,436 @@ + + + + + + + whatsapp-web.js 1.29.0 » Source: structures/Channel.js + + + + + + + + +
+
+
+ +
+ +
+
'use strict';
+
+const Base = require('./Base');
+const Message = require('./Message');
+
+/**
+ * Channel ID structure
+ * @typedef {Object} ChannelId
+ * @property {string} server
+ * @property {string} user
+ * @property {string} _serialized
+ */
+
+/**
+ * Represents a Channel on WhatsApp
+ * @extends {Base}
+ */
+class Channel extends Base {
+    constructor(client, data) {
+        super(client);
+
+        if (data) this._patch(data);
+    }
+
+    _patch(data) {
+        this.channelMetadata = data.channelMetadata;
+
+        /**
+         * ID that represents the channel
+         * @type {ChannelId}
+         */
+        this.id = data.id;
+
+        /**
+         * Title of the channel
+         * @type {string}
+         */
+        this.name = data.name;
+
+        /** 
+         * The channel description
+         * @type {string}
+         */
+        this.description = data.channelMetadata.description;
+
+        /**
+         * Indicates if it is a Channel
+         * @type {boolean}
+         */
+        this.isChannel = data.isChannel;
+
+        /**
+         * Indicates if it is a Group
+         * @type {boolean}
+         */
+        this.isGroup = data.isGroup;
+
+        /**
+         * Indicates if the channel is readonly
+         * @type {boolean}
+         */
+        this.isReadOnly = data.isReadOnly;
+
+        /**
+         * Amount of messages unread
+         * @type {number}
+         */
+        this.unreadCount = data.unreadCount;
+
+        /**
+         * Unix timestamp for when the last activity occurred
+         * @type {number}
+         */
+        this.timestamp = data.t;
+
+        /**
+         * Indicates if the channel is muted or not
+         * @type {boolean}
+         */
+        this.isMuted = data.isMuted;
+
+        /**
+         * Unix timestamp for when the mute expires
+         * @type {number}
+         */
+        this.muteExpiration = data.muteExpiration;
+
+        /**
+         * Last message in the channel
+         * @type {Message}
+         */
+        this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined;
+
+        return super._patch(data);
+    }
+
+    /**
+     * Gets the subscribers of the channel (only those who are in your contact list)
+     * @param {?number} limit Optional parameter to specify the limit of subscribers to retrieve
+     * @returns {Promise<{contact: Contact, role: string}[]>} Returns an array of objects that handle the subscribed contacts and their roles in the channel
+     */
+    async getSubscribers(limit) {
+        return await this.client.pupPage.evaluate(async (channelId, limit) => {
+            const channel = await window.WWebJS.getChat(channelId, { getAsModel: false });
+            if (!channel) return [];
+            !limit && (limit = window.Store.ChannelUtils.getMaxSubscriberNumber());
+            const response = await window.Store.ChannelSubscribers.mexFetchNewsletterSubscribers(channelId, limit);
+            const contacts = window.Store.ChannelSubscribers.getSubscribersInContacts(response.subscribers);
+            return Promise.all(contacts.map((obj) => ({
+                ...obj,
+                contact: window.WWebJS.getContactModel(obj.contact)
+            })));
+        }, this.id._serialized, limit);
+    }
+
+    /**
+     * Updates the channel subject
+     * @param {string} newSubject 
+     * @returns {Promise<boolean>} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
+     */
+    async setSubject(newSubject) {
+        const success = await this._setChannelMetadata({ name: newSubject }, { editName: true });
+        success && (this.name = newSubject);
+        return success;
+    }
+
+    /**
+     * Updates the channel description
+     * @param {string} newDescription 
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async setDescription(newDescription) {
+        const success = await this._setChannelMetadata({ description: newDescription }, { editDescription: true });
+        success && (this.description = newDescription);
+        return success;
+    }
+
+    /**
+     * Updates the channel profile picture
+     * @param {MessageMedia} newProfilePicture 
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async setProfilePicture(newProfilePicture) {
+        return await this._setChannelMetadata({ picture: newProfilePicture }, { editPicture: true });
+    }
+
+    /**
+     * Updates available reactions to use in the channel
+     * 
+     * Valid values for passing to the method are:
+     * 0 for NONE reactions to be avaliable
+     * 1 for BASIC reactions to be available: 👍, ❤️, 😂, 😮, 😢, 🙏
+     * 2 for ALL reactions to be available
+     * @param {number} reactionCode 
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async setReactionSetting(reactionCode) {
+        if (![0, 1, 2].includes(reactionCode)) return false;
+        const reactionMapper = {
+            0: 3,
+            1: 1,
+            2: 0
+        };
+        const success = await this._setChannelMetadata(
+            { reactionCodesSetting: reactionMapper[reactionCode] },
+            { editReactionCodesSetting: true }
+        );
+        success && (this.channelMetadata.reactionCodesSetting = reactionCode);
+        return success;
+    }
+
+    /**
+     * Mutes the channel
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async mute() {
+        const success = await this._muteUnmuteChannel('MUTE');
+        if (success) {
+            this.isMuted = true;
+            this.muteExpiration = -1;
+        }
+        return success;
+    }
+    
+    /**
+     * Unmutes the channel
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async unmute() {
+        const success = await this._muteUnmuteChannel('UNMUTE');
+        if (success) {
+            this.isMuted = false;
+            this.muteExpiration = 0;
+        }
+        return success;
+    }
+
+    /**
+     * Message options
+     * @typedef {Object} MessageSendOptions
+     * @property {?string} caption Image or video caption
+     * @property {?string[]} mentions User IDs of user that will be mentioned in the message
+     * @property {?MessageMedia} media Image or video to be sent
+     */
+
+    /**
+     * Sends a message to this channel
+     * @param {string|MessageMedia} content
+     * @param {?MessageSendOptions} options
+     * @returns {Promise<Message>} Message that was just sent
+     */
+    async sendMessage(content, options) {
+        return this.client.sendMessage(this.id._serialized, content, options);
+    }
+
+    /**
+     * Sets the channel as seen
+     * @returns {Promise<boolean>}
+     */
+    async sendSeen() {
+        return this.client.sendSeen(this.id._serialized);
+    }
+
+    /**
+     * @typedef {Object} SendChannelAdminInviteOptions
+     * @property {?string} comment The comment to be added to an invitation
+     */
+
+    /**
+     * Sends a channel admin invitation to a user, allowing them to become an admin of the channel
+     * @param {string} chatId The ID of a user to send the channel admin invitation to
+     * @param {SendChannelAdminInviteOptions} options 
+     * @returns {Promise<boolean>} Returns true if an invitation was sent successfully, false otherwise
+     */
+    async sendChannelAdminInvite(chatId, options = {}) {
+        return this.client.sendChannelAdminInvite(chatId, this.id._serialized, options);
+    }
+
+    /**
+     * Accepts a channel admin invitation and promotes the current user to a channel admin
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async acceptChannelAdminInvite() {
+        return this.client.acceptChannelAdminInvite(this.id._serialized);
+    }
+
+    /**
+     * Revokes a channel admin invitation sent to a user by a channel owner
+     * @param {string} userId The user ID the invitation was sent to
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async revokeChannelAdminInvite(userId) {
+        return this.client.revokeChannelAdminInvite(this.id._serialized, userId);
+    }
+
+    /**
+     * Demotes a channel admin to a regular subscriber (can be used also for self-demotion)
+     * @param {string} userId The user ID to demote
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async demoteChannelAdmin(userId) {
+        return this.client.demoteChannelAdmin(this.id._serialized, userId);
+    }
+
+    /**
+     * Options for transferring a channel ownership to another user
+     * @typedef {Object} TransferChannelOwnershipOptions
+     * @property {boolean} [shouldDismissSelfAsAdmin = false] If true, after the channel ownership is being transferred to another user, the current user will be dismissed as a channel admin and will become to a channel subscriber.
+     */
+
+    /**
+     * Transfers a channel ownership to another user.
+     * Note: the user you are transferring the channel ownership to must be a channel admin.
+     * @param {string} newOwnerId
+     * @param {TransferChannelOwnershipOptions} options
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async transferChannelOwnership(newOwnerId, options = {}) {
+        return this.client.transferChannelOwnership(this.id._serialized, newOwnerId, options);
+    }
+
+    /**
+     * Loads channel messages, sorted from earliest to latest
+     * @param {Object} searchOptions Options for searching messages. Right now only limit and fromMe is supported
+     * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages
+     * @param {Boolean} [searchOptions.fromMe] Return only messages from the bot number or vise versa. To get all messages, leave the option undefined
+     * @returns {Promise<Array<Message>>}
+     */
+    async fetchMessages(searchOptions) {
+        let messages = await this.client.pupPage.evaluate(async (channelId, searchOptions) => {
+            const msgFilter = (m) => {
+                if (m.isNotification || m.type === 'newsletter_notification') {
+                    return false; // dont include notification messages
+                }
+                if (searchOptions && searchOptions.fromMe !== undefined && m.id.fromMe !== searchOptions.fromMe) {
+                    return false;
+                }
+                return true;
+            };
+
+            const channel = await window.WWebJS.getChat(channelId, { getAsModel: false });
+            let msgs = channel.msgs.getModelsArray().filter(msgFilter);
+
+            if (searchOptions && searchOptions.limit > 0) {
+                while (msgs.length < searchOptions.limit) {
+                    const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(channel);
+                    if (!loadedMessages || !loadedMessages.length) break;
+                    msgs = [...loadedMessages.filter(msgFilter), ...msgs];
+                }
+                
+                if (msgs.length > searchOptions.limit) {
+                    msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
+                    msgs = msgs.splice(msgs.length - searchOptions.limit);
+                }
+            }
+
+            return msgs.map(m => window.WWebJS.getMessageModel(m));
+
+        }, this.id._serialized, searchOptions);
+
+        return messages.map((msg) => new Message(this.client, msg));
+    }
+
+    /**
+     * Deletes the channel you created
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async deleteChannel() {
+        return this.client.deleteChannel(this.id._serialized);
+    }
+
+    /**
+     * Internal method to change the channel metadata
+     * @param {string|number|MessageMedia} value The new value to set
+     * @param {string} property The property of a channel metadata to change
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async _setChannelMetadata(value, property) {
+        return await this.client.pupPage.evaluate(async (channelId, value, property) => {
+            const channel = await window.WWebJS.getChat(channelId, { getAsModel: false });
+            if (!channel) return false;
+            if (property.editPicture) {
+                value.picture = value.picture
+                    ? await window.WWebJS.cropAndResizeImage(value.picture, {
+                        asDataUrl: true,
+                        mimetype: 'image/jpeg',
+                        size: 640,
+                        quality: 1
+                    })
+                    : null;
+            }
+            try {
+                await window.Store.ChannelUtils.editNewsletterMetadataAction(channel, property, value);
+                return true;
+            } catch (err) {
+                if (err.name === 'ServerStatusCodeError') return false;
+                throw err;
+            }
+        }, this.id._serialized, value, property);
+    }
+
+    /**
+     * Internal method to mute or unmute the channel
+     * @param {string} action The action: 'MUTE' or 'UNMUTE'
+     * @returns {Promise<boolean>} Returns true if the operation completed successfully, false otherwise
+     */
+    async _muteUnmuteChannel(action) {
+        return await this.client.pupPage.evaluate(async (channelId, action) => {
+            try {
+                action === 'MUTE'
+                    ? await window.Store.ChannelUtils.muteNewsletter([channelId])
+                    : await window.Store.ChannelUtils.unmuteNewsletter([channelId]);
+                return true;
+            } catch (err) {
+                if (err.name === 'ServerStatusCodeError') return false;
+                throw err;
+            }
+        }, this.id._serialized, action);
+    }
+}
+
+module.exports = Channel;
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index acc877b..53e36c6 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Chat.js + whatsapp-web.js 1.29.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -126,7 +126,7 @@ class Chat extends Base { } /** - * Set the chat as seen + * Sets the chat as seen * @returns {Promise<Boolean>} result */ async sendSeen() { @@ -135,7 +135,7 @@ class Chat extends Base { /** * Clears all messages from the chat - * @returns {Promise<Boolean>} result + * @returns {Promise<boolean>} result */ async clearMessages() { return this.client.pupPage.evaluate(chatId => { @@ -232,7 +232,7 @@ class Chat extends Base { return true; }; - const chat = window.Store.Chat.get(chatId); + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); let msgs = chat.msgs.getModelsArray().filter(msgFilter); if (searchOptions && searchOptions.limit > 0) { @@ -330,7 +330,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 23ae86f..b07d352 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.29.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index f70733d..9e8bb8a 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Contact.js + whatsapp-web.js 1.29.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -247,7 +247,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 5cbd4b9..acce8dd 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.29.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -222,8 +222,7 @@ class GroupChat extends Chat { */ async removeParticipants(participantIds) { return await this.client.pupPage.evaluate(async (chatId, participantIds) => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = await window.Store.Chat.find(chatWid); + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); const participants = participantIds.map(p => { return chat.groupMetadata.participants.get(p); }).filter(p => Boolean(p)); @@ -239,8 +238,7 @@ class GroupChat extends Chat { */ async promoteParticipants(participantIds) { return await this.client.pupPage.evaluate(async (chatId, participantIds) => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = await window.Store.Chat.find(chatWid); + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); const participants = participantIds.map(p => { return chat.groupMetadata.participants.get(p); }).filter(p => Boolean(p)); @@ -256,8 +254,7 @@ class GroupChat extends Chat { */ async demoteParticipants(participantIds) { return await this.client.pupPage.evaluate(async (chatId, participantIds) => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = await window.Store.Chat.find(chatWid); + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); const participants = participantIds.map(p => { return chat.groupMetadata.participants.get(p); }).filter(p => Boolean(p)); @@ -497,8 +494,7 @@ class GroupChat extends Chat { */ async leave() { await this.client.pupPage.evaluate(async chatId => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = await window.Store.Chat.find(chatWid); + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); return window.Store.GroupUtils.sendExitGroup(chat); }, this.id._serialized); } @@ -516,7 +512,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index a87ae8b..d498b64 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.29.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@ module.exports = GroupNotification;
diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index bac0eba..95ee1da 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Label.js + whatsapp-web.js 1.29.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@ module.exports = Label;
diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index f6a8d45..4044bc0 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/List.js + whatsapp-web.js 1.29.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index a66a9c7..0d5980f 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Location.js + whatsapp-web.js 1.29.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -100,7 +100,7 @@ module.exports = Location;
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index a15c8e7..0b8c152 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Message.js + whatsapp-web.js 1.29.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -76,7 +76,7 @@ class Message extends Base { * Indicates if the message has media available for download * @type {boolean} */ - this.hasMedia = Boolean(data.mediaKey && data.directPath); + this.hasMedia = Boolean(data.directPath); /** * Message content @@ -753,7 +753,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 9eb1b40..d334956 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.29.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 5a8db81..5eb6276 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Order.js + whatsapp-web.js 1.29.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@ module.exports = Order;
diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 4114bcf..59c393c 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Payment.js + whatsapp-web.js 1.29.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_Poll.js.html b/docs/structures_Poll.js.html index 1cc1181..c059ee6 100644 --- a/docs/structures_Poll.js.html +++ b/docs/structures_Poll.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Poll.js + whatsapp-web.js 1.29.0 » Source: structures/Poll.js @@ -15,7 +15,7 @@ @@ -83,7 +83,7 @@ module.exports = Poll;
diff --git a/docs/structures_PollVote.js.html b/docs/structures_PollVote.js.html index e081fe1..c534e54 100644 --- a/docs/structures_PollVote.js.html +++ b/docs/structures_PollVote.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/PollVote.js + whatsapp-web.js 1.29.0 » Source: structures/PollVote.js @@ -15,7 +15,7 @@ @@ -100,7 +100,7 @@ module.exports = PollVote;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index dde3ebb..6586796 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.29.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateChat;
diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index ab38fb1..c9994b9 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.29.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 390beb9..aab6f78 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Product.js + whatsapp-web.js 1.29.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@ module.exports = Product;
diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 1458db6..155a807 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.29.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 8f075e8..13e34f8 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: structures/Reaction.js + whatsapp-web.js 1.29.0 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@ module.exports = Reaction;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 4e25425..3605af9 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/Constants.js + whatsapp-web.js 1.29.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -215,7 +215,7 @@ exports.MessageAck = {
diff --git a/docs/util_Injected_LegacyStore.js.html b/docs/util_Injected_LegacyStore.js.html index 874536e..34f0a47 100644 --- a/docs/util_Injected_LegacyStore.js.html +++ b/docs/util_Injected_LegacyStore.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/Injected/LegacyStore.js + whatsapp-web.js 1.29.0 » Source: util/Injected/LegacyStore.js @@ -15,7 +15,7 @@ @@ -184,7 +184,7 @@ exports.ExposeLegacyStore = () => {
diff --git a/docs/util_Injected_Store.js.html b/docs/util_Injected_Store.js.html index a6db1d2..3f2bcf4 100644 --- a/docs/util_Injected_Store.js.html +++ b/docs/util_Injected_Store.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/Injected/Store.js + whatsapp-web.js 1.29.0 » Source: util/Injected/Store.js @@ -15,7 +15,7 @@ @@ -96,7 +96,6 @@ exports.ExposeStore = () => { window.Store.SendSeen = window.require('WAWebUpdateUnreadChatAction'); window.Store.User = window.require('WAWebUserPrefsMeUser'); window.Store.ContactMethods = window.require('WAWebContactGetters'); - window.Store.UploadUtils = window.require('WAWebUploadManager'); window.Store.UserConstructor = window.require('WAWebWid'); window.Store.Validators = window.require('WALinkify'); window.Store.VCard = window.require('WAWebFrontendVcardUtils'); @@ -126,22 +125,21 @@ exports.ExposeStore = () => { window.Store.ReplyUtils = window.require('WAWebMsgReply'); window.Store.BotSecret = window.require('WAWebBotMessageSecret'); window.Store.BotProfiles = window.require('WAWebBotProfileCollection'); + window.Store.ContactCollection = window.require('WAWebContactCollection').ContactCollection; window.Store.DeviceList = window.require('WAWebApiDeviceList'); window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest'); - if (window.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.1014111620')) - window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode; + window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode; + window.Store.ChatGetters = window.require('WAWebChatGetters'); window.Store.Settings = { ...window.require('WAWebUserPrefsGeneral'), ...window.require('WAWebUserPrefsNotifications'), setPushname: window.require('WAWebSetPushnameConnAction').setPushname }; - window.Store.NumberInfo = { ...window.require('WAPhoneUtils'), ...window.require('WAPhoneFindCC') }; - window.Store.ForwardUtils = { ...window.require('WAWebForwardMessagesToChat') }; @@ -172,6 +170,37 @@ exports.ExposeStore = () => { ...window.require('WAWebApiMembershipApprovalRequestStore'), ...window.require('WASmaxGroupsMembershipRequestsActionRPC') }; + window.Store.ChannelUtils = { + ...window.require('WAWebLoadNewsletterPreviewChatAction'), + ...window.require('WAWebNewsletterMetadataQueryJob'), + ...window.require('WAWebNewsletterCreateQueryJob'), + ...window.require('WAWebEditNewsletterMetadataAction'), + ...window.require('WAWebNewsletterDeleteAction'), + ...window.require('WAWebNewsletterSubscribeAction'), + ...window.require('WAWebNewsletterUnsubscribeAction'), + ...window.require('WAWebNewsletterDirectorySearchAction'), + ...window.require('WAWebNewsletterToggleMuteStateJob'), + ...window.require('WAWebNewsletterGatingUtils'), + ...window.require('WAWebNewsletterModelUtils'), + ...window.require('WAWebMexAcceptNewsletterAdminInviteJob'), + ...window.require('WAWebMexRevokeNewsletterAdminInviteJob'), + ...window.require('WAWebChangeNewsletterOwnerAction'), + ...window.require('WAWebDemoteNewsletterAdminAction'), + ...window.require('WAWebNewsletterDemoteAdminJob'), + countryCodesIso: window.require('WAWebCountriesNativeCountryNames'), + currentRegion: window.require('WAWebL10N').getRegion(), + }; + window.Store.SendChannelMessage = { + ...window.require('WAWebNewsletterUpdateMsgsRecordsJob'), + ...window.require('WAWebMsgDataFromModel'), + ...window.require('WAWebNewsletterSendMessageJob'), + ...window.require('WAWebNewsletterSendMsgAction'), + ...window.require('WAMediaCalculateFilehash') + }; + window.Store.ChannelSubscribers = { + ...window.require('WAWebMexFetchNewsletterSubscribersJob'), + ...window.require('WAWebNewsletterSubscriberListAction') + }; window.Store.AddressbookContactUtils = { ...window.require('WAWebSaveContactAction'), ...window.require('WAWebDeleteContactAction') @@ -220,7 +249,7 @@ exports.ExposeStore = () => {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 07d06c6..216e575 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.29.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -45,9 +45,8 @@ class InterfaceController { * @param {string} chatId ID of the chat window that will be opened */ async openChatWindow(chatId) { - await this.pupPage.evaluate(async chatId => { - const chatWid = window.Store.WidFactory.createWid(chatId); - const chat = window.Store.Chat.get(chatWid) || await window.Store.Chat.find(chatWid); + await this.pupPage.evaluate(async (chatId) => { + const chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.openChatBottom(chat); }, chatId); } @@ -58,7 +57,7 @@ class InterfaceController { */ async openChatDrawer(chatId) { await this.pupPage.evaluate(async chatId => { - let chat = await window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.openDrawerMid(chat); }, chatId); } @@ -69,7 +68,7 @@ class InterfaceController { */ async openChatSearch(chatId) { await this.pupPage.evaluate(async chatId => { - let chat = await window.Store.Chat.get(chatId); + let chat = await window.WWebJS.getChat(chatId, { getAsModel: false }); await window.Store.Cmd.chatSearch(chat); }, chatId); } @@ -166,7 +165,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Puppeteer.js.html b/docs/util_Puppeteer.js.html index 3088cac..b8182d7 100644 --- a/docs/util_Puppeteer.js.html +++ b/docs/util_Puppeteer.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/Puppeteer.js + whatsapp-web.js 1.29.0 » Source: util/Puppeteer.js @@ -15,7 +15,7 @@ @@ -62,7 +62,7 @@ module.exports = {exposeFunctionIfAbsent};
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index e978e68..b10c781 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: util/Util.js + whatsapp-web.js 1.29.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@ module.exports = Util;
diff --git a/docs/webCache_LocalWebCache.js.html b/docs/webCache_LocalWebCache.js.html index 9e4260c..c1b187f 100644 --- a/docs/webCache_LocalWebCache.js.html +++ b/docs/webCache_LocalWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: webCache/LocalWebCache.js + whatsapp-web.js 1.29.0 » Source: webCache/LocalWebCache.js @@ -15,7 +15,7 @@ @@ -79,7 +79,7 @@ module.exports = LocalWebCache;
diff --git a/docs/webCache_RemoteWebCache.js.html b/docs/webCache_RemoteWebCache.js.html index 7ca98d5..b8049cd 100644 --- a/docs/webCache_RemoteWebCache.js.html +++ b/docs/webCache_RemoteWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: webCache/RemoteWebCache.js + whatsapp-web.js 1.29.0 » Source: webCache/RemoteWebCache.js @@ -15,7 +15,7 @@ @@ -78,7 +78,7 @@ module.exports = RemoteWebCache;
diff --git a/docs/webCache_WebCache.js.html b/docs/webCache_WebCache.js.html index bec1868..cfcbf80 100644 --- a/docs/webCache_WebCache.js.html +++ b/docs/webCache_WebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.28.1-alpha.0 » Source: webCache/WebCache.js + whatsapp-web.js 1.29.0 » Source: webCache/WebCache.js @@ -15,7 +15,7 @@ @@ -52,7 +52,7 @@ module.exports = {