diff --git a/docs/Base.html b/docs/Base.html index 8b72b80..c8c8fdb 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Base + whatsapp-web.js 1.20.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 45b4f5d..ad240e7 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: BaseAuthStrategy + whatsapp-web.js 1.20.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 8ca3462..9bb1f76 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: BusinessContact + whatsapp-web.js 1.20.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index db66dc3..646c69c 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Buttons + whatsapp-web.js 1.20.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 2ed0b0d..9f6d287 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Call + whatsapp-web.js 1.20.0 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 48ef329..f8d8d21 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Chat + whatsapp-web.js 1.20.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -58,19 +58,22 @@
isReadOnly
+
lastMessage
+
+
muteExpiration
name
-
pinned
-
-
+
pinned
+
+
timestamp
@@ -185,6 +188,11 @@

Indicates if the Chat is readonly

+

lastMessage +  Message

+

Last message fo chat

+
+

muteExpiration  number

Unix timestamp for when the mute expires

@@ -497,7 +505,7 @@
diff --git a/docs/Client.html b/docs/Client.html index 01ef7bb..fcbbad8 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Client + whatsapp-web.js 1.20.0 » Class: Client @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@
-
muteChat(chatId, unmuteDate)
-
-
pinChat()
@@ -168,6 +171,9 @@
setDisplayName(displayName)
+
setProfilePicture(media)
+
+
setStatus(status)
@@ -201,16 +207,28 @@
change_state
-
disconnected
+
chat_archived
-
group_join
+
chat_removed
+
+
+
contact_changed
+
+
+
disconnected
+
group_admin_changed
+
+
+
group_join
+
+
group_leave
@@ -447,6 +465,20 @@

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

+ + +

proxyAuthentication

+ + +

 

+ + +

 

+ + +

Proxy Authentication object.

+ + @@ -473,6 +505,8 @@
Client#event:group_update
Client#event:disconnected
Client#event:change_state
+
Client#event:contact_changed
+
Client#event:group_admin_changed
@@ -638,6 +672,17 @@
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

destroy()

Closes the client

@@ -1515,6 +1560,45 @@
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

@@ -1749,6 +1833,172 @@
+

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

@@ -1782,6 +2032,39 @@
+

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.

@@ -2486,7 +2769,7 @@
diff --git a/docs/Client.js.html b/docs/Client.js.html index 6a180d7..80f345b 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: Client.js + whatsapp-web.js 1.20.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -41,7 +41,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./ut const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -60,6 +60,7 @@ const NoAuth = require('./authStrategies/NoAuth'); * @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. + * @param {object} options.proxyAuthentication - Proxy Authentication object. * * @fires Client#qr * @fires Client#authenticated @@ -76,6 +77,8 @@ const NoAuth = require('./authStrategies/NoAuth'); * @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state + * @fires Client#contact_changed + * @fires Client#group_admin_changed */ class Client extends EventEmitter { constructor(options = {}) { @@ -131,6 +134,10 @@ class Client extends EventEmitter { browser = await puppeteer.launch({...puppeteerOpts, args: browserArgs}); page = (await browser.pages())[0]; } + + if (this.options.proxyAuthentication !== undefined) { + await page.authenticate(this.options.proxyAuthentication); + } await page.setUserAgent(this.options.userAgent); if (this.options.bypassCSP) await page.setBypassCSP(true); @@ -348,6 +355,13 @@ class Client extends EventEmitter { * @param {GroupNotification} notification GroupNotification with more information about the action */ this.emit(Events.GROUP_LEAVE, notification); + } else if (msg.subtype === 'promote' || msg.subtype === 'demote') { + /** + * Emitted when a current user is promoted to an admin or demoted to a regular user. + * @event Client#group_admin_changed + * @param {GroupNotification} notification GroupNotification with more information about the action + */ + this.emit(Events.GROUP_ADMIN_CHANGED, notification); } else { /** * Emitted when group settings are updated, such as subject, description or picture. @@ -407,6 +421,36 @@ class Client extends EventEmitter { last_message = msg; } + /** + * The event notification that is received when one of + * the group participants changes thier phone number. + */ + const isParticipant = msg.type === 'gp2' && msg.subtype === 'modify'; + + /** + * The event notification that is received when one of + * the contacts changes thier phone number. + */ + const isContact = msg.type === 'notification_template' && msg.subtype === 'change_number'; + + if (isParticipant || isContact) { + /** {@link GroupNotification} object does not provide enough information about this event, so a {@link Message} object is used. */ + const message = new Message(this, msg); + + const newId = isParticipant ? msg.recipients[0] : msg.to; + const oldId = isParticipant ? msg.author : msg.templateParams.find(id => id !== newId); + + /** + * Emitted when a contact or a group participant changes their phone number. + * @event Client#contact_changed + * @param {Message} message Message with more information about the event. + * @param {String} oldId The user's id (an old one) who changed their phone number + * and who triggered the notification. + * @param {String} newId The user's new id after the change. + * @param {Boolean} isContact Indicates if a contact or a group participant changed their phone number. + */ + this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact); + } }); await page.exposeFunction('onRemoveMessageEvent', (msg) => { @@ -438,6 +482,15 @@ class Client extends EventEmitter { }); + await page.exposeFunction('onChatUnreadCountEvent', async (data) =>{ + const chat = await this.getChatById(data.id); + + /** + * Emitted when the chat unread count changes + */ + this.emit(Events.UNREAD_COUNT, chat); + }); + await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => { const message = new Message(this, msg); @@ -538,6 +591,26 @@ class Client extends EventEmitter { } }); + await page.exposeFunction('onRemoveChatEvent', (chat) => { + /** + * Emitted when a chat is removed + * @event Client#chat_removed + * @param {Chat} chat + */ + this.emit(Events.CHAT_REMOVED, new Chat(this, chat)); + }); + + await page.exposeFunction('onArchiveChatEvent', (chat, currState, prevState) => { + /** + * Emitted when a chat is archived/unarchived + * @event Client#chat_archived + * @param {Chat} chat + * @param {boolean} currState + * @param {boolean} prevState + */ + this.emit(Events.CHAT_ARCHIVED, new Chat(this, chat), currState, prevState); + }); + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); @@ -547,6 +620,8 @@ class Client extends EventEmitter { window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); window.Store.Call.on('add', (call) => { window.onIncomingCall(call); }); + window.Store.Chat.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WWebJS.getChatModel(chat)); }); + window.Store.Chat.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WWebJS.getChatModel(chat), currState, prevState); }); window.Store.Msg.on('add', (msg) => { if (msg.isNewMsg) { if(msg.type === 'ciphertext') { @@ -557,7 +632,8 @@ class Client extends EventEmitter { } } }); - + window.Store.Chat.on('change:unreadCount', (chat) => {window.onChatUnreadCountEvent(chat);}); + { const module = window.Store.createOrUpdateReactionsModule; const ogMethod = module.createOrUpdateReactions; @@ -1209,6 +1285,31 @@ class Client extends EventEmitter { return blockedContacts.map(contact => ContactFactory.create(this.client, contact)); } + + /** + * Sets the current user's profile picture. + * @param {MessageMedia} media + * @returns {Promise<boolean>} Returns true if the picture was properly updated. + */ + async setProfilePicture(media) { + const success = await this.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.info.wid._serialized, media); + + return success; + } + + /** + * Deletes the current user's profile picture. + * @returns {Promise<boolean>} Returns true if the picture was properly deleted. + */ + async deleteProfilePicture() { + const success = await this.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.info.wid._serialized); + + return success; + } } module.exports = Client; @@ -1222,7 +1323,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 0221135..9e3ec10 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: ClientInfo + whatsapp-web.js 1.20.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html index 29a9d00..e6fd4f8 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Contact + whatsapp-web.js 1.20.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html index a27f22d..3065d2e 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: GroupChat + whatsapp-web.js 1.20.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -64,19 +64,22 @@
isReadOnly
+
lastMessage
+
+
muteExpiration
name
-
owner
-
-
+
owner
+
+
participants
@@ -113,6 +116,9 @@
delete()
+
deletePicture()
+
+
demoteParticipants(participantIds)
@@ -125,13 +131,13 @@
getInviteCode()
-
getLabels()
-
-
+
getLabels()
+
+
leave()
@@ -159,13 +165,13 @@
sendSeen()
-
sendStateRecording()
-
-
+
sendStateRecording()
+
+
sendStateTyping()
@@ -178,6 +184,9 @@
setMessagesAdminsOnly([adminsOnly])
+
setPicture(media)
+
+
setSubject(subject)
@@ -250,6 +259,13 @@
Inherited from
Chat#isReadOnly
+

lastMessage +  unknown

+

Last message fo chat

+
+
Inherited from
+
Chat#lastMessage
+

muteExpiration  unknown

Unix timestamp for when the mute expires

@@ -372,6 +388,17 @@
async
+

deletePicture() → Promise containing boolean

+

Deletes the group's picture.

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.

+

+
+
+
async

demoteParticipants(participantIds) → Promise containing {status: number}

Demotes participants by IDs to regular users

@@ -868,6 +895,45 @@
async
+

setPicture(media) → Promise containing boolean

+

Sets the group's picture.

+
+

Parameter

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

media

+
+

MessageMedia

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.

+

+
+
+
async

setSubject(subject) → Promise containing boolean

Updates the group subject

@@ -941,7 +1007,7 @@
diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 739b7a2..b26ef11 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: GroupNotification + whatsapp-web.js 1.20.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@
diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 862364c..9826824 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: InterfaceController + whatsapp-web.js 1.20.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@
diff --git a/docs/Label.html b/docs/Label.html index da6fac5..ddbe7fc 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Label + whatsapp-web.js 1.20.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@
diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index b248e58..6fdde0b 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: LegacySessionAuth + whatsapp-web.js 1.20.0 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@
diff --git a/docs/List.html b/docs/List.html index f2c4aff..d1190a5 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: List + whatsapp-web.js 1.20.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 1a4f18a..e722be2 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: LocalAuth + whatsapp-web.js 1.20.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/Location.html b/docs/Location.html index 0c80012..012a74a 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Location + whatsapp-web.js 1.20.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@
diff --git a/docs/Message.html b/docs/Message.html index d528a72..6d47a76 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Message + whatsapp-web.js 1.20.0 » Class: Message @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@
+
location
+
+
mediaKey
@@ -180,13 +183,16 @@
getQuotedMessage()
-
react(reaction)
+
getReactions()
+
react(reaction)
+
+
reload()
@@ -270,6 +276,11 @@

Indicates if the message was sent as a reply to another message.

+

hasReaction +  boolean

+

Indicates whether there are reactions to the message

+
+

id  object

ID that represents the message

@@ -518,6 +529,15 @@
async
+

getReactions() → Promise containing Array of ReactionList

+

Gets the reactions associated with the given message

+
+
Returns
+
+

Promise containing Array of ReactionList 

+
+
+
async

react(reaction) → Promise

React to this message with an emoji

@@ -650,7 +670,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 17046c4..5d617b8 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: MessageMedia + whatsapp-web.js 1.20.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@
diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 1ee676e..d112cbc 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: NoAuth + whatsapp-web.js 1.20.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@
diff --git a/docs/Order.html b/docs/Order.html index a116147..f63b6d4 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Order + whatsapp-web.js 1.20.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index d903c67..19e1e47 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: PrivateChat + whatsapp-web.js 1.20.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -58,19 +58,22 @@
isReadOnly
+
lastMessage
+
+
muteExpiration
name
-
pinned
-
-
+
pinned
+
+
timestamp
@@ -195,6 +198,13 @@
Inherited from
Chat#isReadOnly
+

lastMessage +  unknown

+

Last message fo chat

+
+
Inherited from
+
Chat#lastMessage
+

muteExpiration  unknown

Unix timestamp for when the mute expires

@@ -533,7 +543,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index b41f3e9..20d0e9e 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: PrivateContact + whatsapp-web.js 1.20.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@ diff --git a/docs/Product.html b/docs/Product.html index 549ce62..9212e02 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Product + whatsapp-web.js 1.20.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index ade180c..b56459f 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Reaction + whatsapp-web.js 1.20.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 077388e..4003fc4 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: RemoteAuth + whatsapp-web.js 1.20.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@ diff --git a/docs/Util.html b/docs/Util.html index ca629ba..3c6ea6b 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Util + whatsapp-web.js 1.20.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 2d02c68..d8b4b2d 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.20.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@ module.exports = BaseAuthStrategy; diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 3c9e0d3..44642fd 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@ module.exports = LegacySessionAuth; diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 9b37006..58688ab 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@ module.exports = LocalAuth; diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 6321c1d..97d6551 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.20.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 b4a777f..c42fea6 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@ module.exports = RemoteAuth; diff --git a/docs/global.html b/docs/global.html index 50c2cb3..206a6ff 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Globals + whatsapp-web.js 1.20.0 » Globals @@ -15,7 +15,7 @@ @@ -94,6 +94,9 @@
+
ReactionList
+
+
StickerMetadata
@@ -220,6 +223,32 @@ + + +

CHAT_REMOVED

+ + +

 

+ + +

 

+ + + + + + +

CHAT_ARCHIVED

+ + +

 

+ + +

 

+ + + +

MESSAGE_RECEIVED

@@ -285,6 +314,19 @@ + + +

UNREAD_COUNT

+ + +

 

+ + +

 

+ + + +

MESSAGE_REACTION

@@ -311,6 +353,19 @@ + + +

CONTACT_CHANGED

+ + +

 

+ + +

 

+ + + +

GROUP_JOIN

@@ -337,6 +392,19 @@ + + +

GROUP_ADMIN_CHANGED

+ + +

 

+ + +

 

+ + + +

GROUP_UPDATE

@@ -1950,6 +2018,82 @@
+

ReactionList +  Object

+

Reaction List

+
+

Properties

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

id

+
+

string

+
+

 

+
+

Original emoji

+
+

aggregateEmoji

+
+

string

+
+

 

+
+

aggregate emoji

+
+

hasReactionByMe

+
+

boolean

+
+

 

+
+

Flag who sent the reaction

+
+

senders

+
+

Array of Reaction

+
+

 

+
+

Reaction senders, to this message

+
+
+
+

StickerMetadata  Object

Sticker metadata.

@@ -2019,7 +2163,7 @@
diff --git a/docs/index.html b/docs/index.html index 17e9fb8..8fa8a46 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,53 +1,52 @@ - - - - - whatsapp-web.js 1.19.5 » Home - - - - - - - - + +
+
+
+ +
+ + +

npm Depfu WhatsApp_Web 2.2306.7 Discord Chat

+

whatsapp-web.js

+

A WhatsApp API client that connects through the WhatsApp Web browser app

+

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

+

NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.

+

Quick Links

+ +

Installation

+

The module is now available on npm! npm i whatsapp-web.js

+

Please note that Node v12+ is required.

+

Example usage

+
const { Client } = require('whatsapp-web.js');
 
 const client = new Client();
 
@@ -68,3229 +67,3427 @@ client.on('message', msg => {
 
 client.initialize();
 
-

Take a look at example.js for another example with more use cases.

-

For more information on saving and restoring sessions, check out the available Authentication Strategies.

-

Supported features

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureStatus
Multi Device✅
Send messages✅
Receive messages✅
Send media (images/audio/documents)✅
Send media (video)✅ (requires google chrome)
Send stickers✅
Receive media (images/audio/video/documents)✅
Send contact cards✅
Send location✅
Send buttons✅
Send lists✅ (business accounts not supported)
Receive location✅
Message replies✅
Join groups by invite✅
Get invite for group✅
Modify group info (subject, description)✅
Modify group settings (send messages, edit info)✅
Add group participants✅
Kick group participants✅
Promote/demote group participants✅
Mention users✅
Mute/unmute chats✅
Block/unblock contacts✅
Get contact info✅
Get profile pictures✅
Set user status message✅
React to messages✅
-

Something missing? Make an issue and let us know!

-

Contributing

-

Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

-

Supporting the project

-

You can support the maintainer of this project through the links below

- -

Disclaimer

-

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

-

License

-

Copyright 2019 Pedro S Lopez

-

Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this project except in compliance with the License. - You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

-

Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.

-
-
-
-
+

Take a look at example.js for another example with more use cases.

+

For more information on saving and restoring sessions, check out the available Authentication Strategies.

+

Supported features

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureStatus
Multi Device✅
Send messages✅
Receive messages✅
Send media (images/audio/documents)✅
Send media (video)✅ (requires google chrome)
Send stickers✅
Receive media (images/audio/video/documents)✅
Send contact cards✅
Send location✅
Send buttons✅
Send lists✅ (business accounts not supported)
Receive location✅
Message replies✅
Join groups by invite✅
Get invite for group✅
Modify group info (subject, description)✅
Modify group settings (send messages, edit info)✅
Add group participants✅
Kick group participants✅
Promote/demote group participants✅
Mention users✅
Mute/unmute chats✅
Block/unblock contacts✅
Get contact info✅
Get profile pictures✅
Set user status message✅
React to messages✅
+

Something missing? Make an issue and let us know!

+

Contributing

+

Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

+

Supporting the project

+

You can support the maintainer of this project through the links below

+ +

Disclaimer

+

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

+

License

+

Copyright 2019 Pedro S Lopez

+

Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this project except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

+

Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.

+ +
+
+

Base

-
-
-
- Base() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Base() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

BaseAuthStrategy

-
-
-
- BaseAuthStrategy() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ BaseAuthStrategy() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

BusinessContact

- - - + + + + + +
-
-
-
-
+
+
+
+

Buttons

- -
-
-
- Buttons#body -
-
-
-
- Buttons#buttons -
-
-
-
-
-
-
-
- Buttons#footer -
-
-
-
- Buttons#title -
-
-
-
-
+ + +
+
+
+ Buttons#body +
+
+
+
+ Buttons#buttons +
+
+
+
+
+ +
+
+
+ Buttons#footer +
+
+
+
+ Buttons#title +
+
+
+
+
+
-
-
-
-
+
+
+
+

Call

-
-
-
- Call() -
-
-
-
- Call#canHandleLocally -
-
-
-
- Call#from -
-
-
-
- Call#fromMe -
-
-
-
-
-
-
-
- Call#id -
-
-
-
- Call#isGroup -
-
-
-
- Call#isVideo -
-
-
-
- Call#participants -
-
-
-
-
-
-
-
- Call#reject() -
-
-
-
- Call#timestamp -
-
-
-
- Call#webClientShouldHandle -
-
-
-
-
+
+
+
+ Call() +
+
+
+
+ Call#canHandleLocally +
+
+
+
+ Call#from +
+
+
+
+ Call#fromMe +
+
+
+
+
+ +
+
+
+ Call#id +
+
+
+
+ Call#isGroup +
+
+
+
+ Call#isVideo +
+
+
+
+ Call#participants +
+
+
+
+
+ +
+
+
+ Call#reject() +
+
+
+
+ Call#timestamp +
+
+
+
+ Call#webClientShouldHandle +
+
+
+
+
+
-
-
-
-
+
+
+
+

Chat

-
-
-
- Chat() -
-
-
-
- Chat#archive() -
-
-
-
- Chat#archived -
-
-
-
- Chat#clearMessages() -
-
-
-
- Chat#clearState() -
-
-
-
- Chat#delete() -
-
-
-
- Chat#fetchMessages(searchOptions) -
-
-
-
- Chat#getContact() -
-
-
-
- Chat#getLabels() -
-
-
-
- Chat#id -
-
-
-
-
-
-
-
- Chat#isGroup -
-
-
-
- Chat#isMuted -
-
-
-
- Chat#isReadOnly -
-
-
-
- Chat#markUnread() -
-
-
-
- Chat#mute(unmuteDate) -
-
-
-
- Chat#muteExpiration -
-
-
-
- Chat#name -
-
-
-
- Chat#pin() -
-
-
-
- Chat#pinned -
-
-
-
- Chat#sendMessage(content[, options]) -
-
-
-
-
-
-
-
- Chat#sendSeen() -
-
-
-
- Chat#sendStateRecording() -
-
-
-
- Chat#sendStateTyping() -
-
-
-
- Chat#timestamp -
-
-
-
- Chat#unarchive() -
-
-
-
- Chat#unmute() -
-
-
-
- Chat#unpin() -
-
-
-
- Chat#unreadCount -
-
-
-
-
+
+
+
+ Chat() +
+
+
+
+ Chat#archive() +
+
+
+
+ Chat#archived +
+
+
+
+ Chat#clearMessages() +
+
+
+
+ Chat#clearState() +
+
+
+
+ Chat#delete() +
+
+
+
+ Chat#fetchMessages(searchOptions) +
+
+
+
+ Chat#getContact() +
+
+
+
+ Chat#getLabels() +
+
+
+
+ Chat#id +
+
+
+
+
+ +
+
+
+ Chat#isGroup +
+
+
+
+ Chat#isMuted +
+
+
+
+ Chat#isReadOnly +
+
+
+
+ Chat#lastMessage +
+
+
+
+ Chat#markUnread() +
+
+
+
+ Chat#mute(unmuteDate) +
+
+
+
+ Chat#muteExpiration +
+
+
+
+ Chat#name +
+
+
+
+ Chat#pin() +
+
+
+
+ Chat#pinned +
+
+
+
+
+ + +
-
-
-
-
+
+
+
+

ChatTypes

-
-
-
- ChatTypes.GROUP -
-
-
-
-
-
-
-
- ChatTypes.SOLO -
-
-
-
-
-
-
-
- ChatTypes.UNKNOWN -
-
-
-
-
+
+
+
+ ChatTypes.GROUP +
+
+
+
+
+ +
+
+
+ ChatTypes.SOLO +
+
+
+
+
+ +
+
+
+ ChatTypes.UNKNOWN +
+
+
+
+
+
-
-
-
-
+
+
+
+

Client

- - - + + + + + +
-
-
-
-
+
+
+
+

ClientInfo

-
-
-
- ClientInfo() -
-
-
-
- ClientInfo#getBatteryStatus() -
-
-
-
- ClientInfo#me -
-
-
-
-
-
-
-
- ClientInfo#phone -
-
-
-
- ClientInfo#platform -
-
-
-
- ClientInfo#pushname -
-
-
-
-
-
-
-
- ClientInfo#wid -
-
-
-
-
+
+
+
+ ClientInfo() +
+
+
+
+ ClientInfo#getBatteryStatus() +
+
+
+
+ ClientInfo#me +
+
+
+
+
+ +
+
+
+ ClientInfo#phone +
+
+
+
+ ClientInfo#platform +
+
+
+
+ ClientInfo#pushname +
+
+
+
+
+ +
+
+
+ ClientInfo#wid +
+
+
+
+
+
-
-
-
-
+
+
+
+

Contact

- -
-
-
- Contact#id -
-
-
-
- Contact#isBlocked -
-
-
-
- Contact#isBusiness -
-
-
-
- Contact#isEnterprise -
-
-
-
- Contact#isGroup -
-
-
-
- Contact#isMe -
-
-
-
- Contact#isMyContact -
-
-
-
- Contact#isUser -
-
-
-
-
-
-
-
- Contact#isWAContact -
-
-
-
- Contact#name -
-
-
-
- Contact#number -
-
-
-
- Contact#pushname -
-
-
-
- Contact#shortName -
-
-
-
- Contact#unblock() -
-
-
-
-
+ + +
+
+
+ Contact#id +
+
+
+
+ Contact#isBlocked +
+
+
+
+ Contact#isBusiness +
+
+
+
+ Contact#isEnterprise +
+
+
+
+ Contact#isGroup +
+
+
+
+ Contact#isMe +
+
+
+
+ Contact#isMyContact +
+
+
+
+ Contact#isUser +
+
+
+
+
+ +
+
+
+ Contact#isWAContact +
+
+
+
+ Contact#name +
+
+
+
+ Contact#number +
+
+
+
+ Contact#pushname +
+
+
+
+ Contact#shortName +
+
+
+
+ Contact#unblock() +
+
+
+
+
+
-
-
-
-
+
+
+
+

Events

- - - + + + + + +
-
-
-
-
+
+
+
+

GroupChat

- - - + + + + + +
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+ -
-
-
+
+
+
+ -
-
-
+
+
+
+

Label

-
-
-
- Label(client, labelData) -
-
-
-
- Label#getChats() -
-
-
-
-
-
-
-
- Label#hexColor -
-
-
-
- Label#id -
-
-
-
-
-
-
-
- Label#name -
-
-
-
-
+
+
+
+ Label(client, labelData) +
+
+
+
+ Label#getChats() +
+
+
+
+
+ +
+
+
+ Label#hexColor +
+
+
+
+ Label#id +
+
+
+
+
+ +
+
+
+ Label#name +
+
+
+
+
+
-
-
-
-
+
+
+
+

LegacySessionAuth

-
-
-
- LegacySessionAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+ + +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

List

- -
-
-
- List#description -
-
-
-
- List#footer -
-
-
-
- List#sections -
-
-
-
-
-
-
-
- List#title -
-
-
-
-
+ + +
+
+
+ List#description +
+
+
+
+ List#footer +
+
+
+
+ List#sections +
+
+
+
+
+ +
+
+
+ List#title +
+
+
+
+
+
-
-
-
-
+
+
+
+

LocalAuth

-
-
-
- LocalAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ LocalAuth(options) +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Location

- -
-
-
- Location#latitude -
-
-
-
- Location#longitude -
-
-
-
-
-
-
-
-
+ + +
+
+
+ Location#latitude +
+
+
+
+ Location#longitude +
+
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Message

- - - + + + + +
+
+
+ Message#links +
+
+
+
+ Message#location +
+
+
+
+ Message#mediaKey +
+
+
+
+ Message#mentionedIds +
+
+
+
+ Message#orderId +
+
+
+
+ Message#rawData +
+
+
+
+ Message#react(reaction) +
+
+
+
+ Message#reload() +
+
+
+
+ Message#reply(content[, chatId][, options]) +
+
+
+
+ Message#star() +
+
+
+
+ Message#timestamp +
+
+
+
+ Message#to +
+
+
+
+ Message#token +
+
+
+
+ Message#type +
+
+
+
+ Message#unstar() +
+
+
+
+ Message#vCards +
+
+
+
+
+
-
-
-
-
+
+
+
+

MessageAck

-
-
-
- MessageAck.ACK_DEVICE -
-
-
-
- MessageAck.ACK_ERROR -
-
-
-
-
-
-
-
- MessageAck.ACK_PENDING -
-
-
-
- MessageAck.ACK_PLAYED -
-
-
-
-
-
-
-
- MessageAck.ACK_READ -
-
-
-
- MessageAck.ACK_SERVER -
-
-
-
-
+
+
+
+ MessageAck.ACK_DEVICE +
+
+
+
+ MessageAck.ACK_ERROR +
+
+
+
+
+ + + +
+
+
+ MessageAck.ACK_READ +
+
+
+
+ MessageAck.ACK_SERVER +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

MessageTypes

- - - + + + + + +
-
-
-
-
+
+
+
+

NoAuth

-
-
-
- NoAuth() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ NoAuth() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Order

-
-
-
- Order() -
-
-
-
- Order#createdAt -
-
-
-
-
-
-
-
- Order#currency -
-
-
-
- Order#subtotal -
-
-
-
-
-
-
-
- Order#total -
-
-
-
-
+
+
+
+ Order() +
+
+
+
+ Order#createdAt +
+
+
+
+
+ +
+
+
+ Order#currency +
+
+
+
+ Order#subtotal +
+
+
+
+
+ +
+
+
+ Order#total +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

PrivateChat

- - - + + + + + +
-
-
-
-
+
+
+
+

PrivateContact

- - - + + + + + +
-
-
-
-
+
+
+
+

Product

-
-
-
- Product() -
-
-
-
- Product#currency -
-
-
-
- Product#data -
-
-
-
-
-
-
-
- Product#id -
-
-
-
- Product#name -
-
-
-
- Product#price -
-
-
-
-
-
-
-
- Product#quantity -
-
-
-
- Product#thumbnailUrl -
-
-
-
-
+
+
+
+ Product() +
+
+
+
+ Product#currency +
+
+
+
+ Product#data +
+
+
+
+
+ +
+
+
+ Product#id +
+
+
+
+ Product#name +
+
+
+
+ Product#price +
+
+
+
+
+ +
+
+
+ Product#quantity +
+
+
+
+ Product#thumbnailUrl +
+
+
+
+
+
-
-
-
-
+
+
+
+

ProductMetadata

- - -
-
-
-
+ + + + +
+
+
+
+
-
-
-
-
+
+
+
+

Reaction

-
-
-
- Reaction() -
-
-
-
- Reaction#ack -
-
-
-
- Reaction#id -
-
-
-
- Reaction#msgId -
-
-
-
-
-
-
-
- Reaction#orphan -
-
-
-
- Reaction#orphanReason -
-
-
-
- Reaction#reaction -
-
-
-
- Reaction#read -
-
-
-
-
-
-
-
- Reaction#senderId -
-
-
-
- Reaction#timestamp -
-
-
-
-
+
+
+
+ Reaction() +
+
+
+
+ Reaction#ack +
+
+
+
+ Reaction#id +
+
+
+
+ Reaction#msgId +
+
+
+
+
+ +
+
+
+ Reaction#orphan +
+
+
+
+ Reaction#orphanReason +
+
+
+
+ Reaction#reaction +
+
+
+
+ Reaction#read +
+
+
+
+
+ +
+
+
+ Reaction#senderId +
+
+
+
+ Reaction#timestamp +
+
+
+
+
+
-
-
-
-
+
+
+
+

RemoteAuth

-
-
-
- RemoteAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ RemoteAuth(options) +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Status

-
-
-
- Status.AUTHENTICATING -
-
-
-
-
-
-
-
- Status.INITIALIZING -
-
-
-
-
-
-
-
- Status.READY -
-
-
-
-
+
+
+
+ Status.AUTHENTICATING +
+
+
+
+
+ +
+
+
+ Status.INITIALIZING +
+
+
+
+
+ +
+
+
+ Status.READY +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

WAState

-
-
-
- WAState.CONFLICT -
-
-
-
- WAState.CONNECTED -
-
-
-
- WAState.DEPRECATED_VERSION -
-
-
-
- WAState.OPENING -
-
-
-
-
-
-
-
- WAState.PAIRING -
-
-
-
- WAState.PROXYBLOCK -
-
-
-
- WAState.SMB_TOS_BLOCK -
-
-
-
- WAState.TIMEOUT -
-
-
-
-
-
-
-
- WAState.TOS_BLOCK -
-
-
-
- WAState.UNLAUNCHED -
-
-
-
- WAState.UNPAIRED -
-
-
-
- WAState.UNPAIRED_IDLE -
-
-
-
-
-
-
-
-
-
-
- -
-
-
- -
- - - - - - - +
+
+
+ WAState.CONFLICT +
+
+
+
+ WAState.CONNECTED +
+
+
+
+ WAState.DEPRECATED_VERSION +
+
+
+
+ WAState.OPENING +
+
+
+
+
- \ No newline at end of file +
+
+
+ WAState.PAIRING +
+
+
+
+ WAState.PROXYBLOCK +
+
+
+
+ WAState.SMB_TOS_BLOCK +
+
+
+
+ WAState.TIMEOUT +
+
+
+
+
+ +
+
+
+ WAState.TOS_BLOCK +
+
+
+
+ WAState.UNLAUNCHED +
+
+
+
+ WAState.UNPAIRED +
+
+
+
+ WAState.UNPAIRED_IDLE +
+
+
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 9298998..d43cdba 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Base.js + whatsapp-web.js 1.20.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@ module.exports = Base; diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 3b5feb7..1912469 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/BusinessContact.js + whatsapp-web.js 1.20.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 7637c6c..96a7203 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Buttons.js + whatsapp-web.js 1.20.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 09504d6..98dfdff 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Call.js + whatsapp-web.js 1.20.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@ module.exports = Call; diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index e470070..9baaa84 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Chat.js + whatsapp-web.js 1.20.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -106,6 +106,12 @@ class Chat extends Base { */ this.muteExpiration = data.muteExpiration; + /** + * Last message fo chat + * @type {Message} + */ + this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined; + return super._patch(data); } @@ -299,7 +305,7 @@ module.exports = Chat; diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 5c59f84..d7878b8 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/ClientInfo.js + whatsapp-web.js 1.20.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 9659220..bce1f31 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Contact.js + whatsapp-web.js 1.20.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@ module.exports = Contact; diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 03ef7ee..737830f 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/GroupChat.js + whatsapp-web.js 1.20.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -244,6 +244,31 @@ class GroupChat extends Chat { return true; } + /** + * Deletes the group's picture. + * @returns {Promise<boolean>} Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions. + */ + async deletePicture() { + const success = await this.client.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.id._serialized); + + return success; + } + + /** + * Sets the group's picture. + * @param {MessageMedia} media + * @returns {Promise<boolean>} Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions. + */ + async setPicture(media) { + const success = await this.client.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.id._serialized, media); + + return success; + } + /** * Gets the invite code for a specific group * @returns {Promise<string>} Group's invite code @@ -294,7 +319,7 @@ module.exports = GroupChat; diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 8885d69..4c3a80c 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/GroupNotification.js + whatsapp-web.js 1.20.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 0085387..e30b9a3 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Label.js + whatsapp-web.js 1.20.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 4939fa1..a258dd4 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/List.js + whatsapp-web.js 1.20.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 2e263b6..cb490a8 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Location.js + whatsapp-web.js 1.20.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@ module.exports = Location; diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 42962cb..e86248c 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Message.js + whatsapp-web.js 1.20.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -36,7 +36,8 @@ const MessageMedia = require('./MessageMedia'); const Location = require('./Location'); const Order = require('./Order'); const Payment = require('./Payment'); -const { MessageTypes } = require('../util/Constants'); +const Reaction = require('./Reaction'); +const {MessageTypes} = require('../util/Constants'); /** * Represents a Message on WhatsApp @@ -119,8 +120,7 @@ class Message extends Base { * String that represents from which device type the message was sent * @type {string} */ - this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web'; - + this.deviceType = typeof data.id.id === 'string' && data.id.id.length > 21 ? 'android' : typeof data.id.id === 'string' && data.id.id.substring(0, 2) === '3A' ? 'ios' : 'web'; /** * Indicates if the message was forwarded * @type {boolean} @@ -139,7 +139,7 @@ class Message extends Base { * Indicates if the message is a status update * @type {boolean} */ - this.isStatus = data.isStatusV3; + this.isStatus = data.isStatusV3 || data.id.remote === 'status@broadcast'; /** * Indicates if the message was starred @@ -165,6 +165,12 @@ class Message extends Base { */ this.hasQuotedMsg = data.quotedMsg ? true : false; + /** + * Indicates whether there are reactions to the message + * @type {boolean} + */ + this.hasReaction = data.hasReaction ? true : false; + /** * Indicates the duration of the message in seconds * @type {string} @@ -467,15 +473,16 @@ class Message extends Base { * @param {?boolean} everyone If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat. */ async delete(everyone) { - await this.client.pupPage.evaluate((msgId, everyone) => { + await this.client.pupPage.evaluate(async (msgId, everyone) => { let msg = window.Store.Msg.get(msgId); - + let chat = await window.Store.Chat.find(msg.id.remote); + const canRevoke = window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg); if (everyone && canRevoke) { - return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' }); + return window.Store.Cmd.sendRevokeMsgs(chat, [msg], { clearMedia: true, type: msg.id.fromMe ? 'Sender' : 'Admin' }); } - return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true); + return window.Store.Cmd.sendDeleteMsgs(chat, [msg], true); }, this.id._serialized, everyone); } @@ -483,11 +490,12 @@ class Message extends Base { * Stars this message */ async star() { - await this.client.pupPage.evaluate((msgId) => { + await this.client.pupPage.evaluate(async (msgId) => { let msg = window.Store.Msg.get(msgId); - + if (window.Store.MsgActionChecks.canStarMsg(msg)) { - return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false); + let chat = await window.Store.Chat.find(msg.id.remote); + return window.Store.Cmd.sendStarMsgs(chat, [msg], false); } }, this.id._serialized); } @@ -496,11 +504,12 @@ class Message extends Base { * Unstars this message */ async unstar() { - await this.client.pupPage.evaluate((msgId) => { + await this.client.pupPage.evaluate(async (msgId) => { let msg = window.Store.Msg.get(msgId); if (window.Store.MsgActionChecks.canStarMsg(msg)) { - return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false); + let chat = await window.Store.Chat.find(msg.id.remote); + return window.Store.Cmd.sendUnstarMsgs(chat, [msg], false); } }, this.id._serialized); } @@ -560,6 +569,44 @@ class Message extends Base { } return undefined; } + + + /** + * Reaction List + * @typedef {Object} ReactionList + * @property {string} id Original emoji + * @property {string} aggregateEmoji aggregate emoji + * @property {boolean} hasReactionByMe Flag who sent the reaction + * @property {Array<Reaction>} senders Reaction senders, to this message + */ + + /** + * Gets the reactions associated with the given message + * @return {Promise<ReactionList[]>} + */ + async getReactions() { + if (!this.hasReaction) { + return undefined; + } + + const reactions = await this.client.pupPage.evaluate(async (msgId) => { + const msgReactions = await window.Store.Reactions.find(msgId); + if (!msgReactions || !msgReactions.reactions.length) return null; + return msgReactions.reactions.serialize(); + }, this.id._serialized); + + if (!reactions) { + return undefined; + } + + return reactions.map(reaction => { + reaction.senders = reaction.senders.map(sender => { + sender.timestamp = Math.round(sender.timestamp / 1000); + return new Reaction(this.client, sender); + }); + return reaction; + }); + } } module.exports = Message; @@ -573,7 +620,7 @@ module.exports = Message; diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 5648e76..eac0353 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/MessageMedia.js + whatsapp-web.js 1.20.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 3da4bef..ab36e66 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Order.js + whatsapp-web.js 1.20.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 2392de0..197016b 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Payment.js + whatsapp-web.js 1.20.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = Payment; diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 46d5c2e..a247712 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/PrivateChat.js + whatsapp-web.js 1.20.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 0bf5268..d30f3c3 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/PrivateContact.js + whatsapp-web.js 1.20.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 6a42dbf..c991bc9 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Product.js + whatsapp-web.js 1.20.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 be6fa76..e370c26 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.20.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 e4e4b00..2af40de 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Reaction.js + whatsapp-web.js 1.20.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 9389185..2d15580 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/Constants.js + whatsapp-web.js 1.20.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -44,7 +44,8 @@ exports.DefaultOptions = { takeoverTimeoutMs: 0, userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36', ffmpegPath: 'ffmpeg', - bypassCSP: false + bypassCSP: false, + proxyAuthentication: undefined }; /** @@ -67,15 +68,20 @@ exports.Events = { AUTHENTICATED: 'authenticated', AUTHENTICATION_FAILURE: 'auth_failure', READY: 'ready', + CHAT_REMOVED: 'chat_removed', + CHAT_ARCHIVED: 'chat_archived', MESSAGE_RECEIVED: 'message', MESSAGE_CREATE: 'message_create', MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_ACK: 'message_ack', + UNREAD_COUNT: 'unread_count', MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', + CONTACT_CHANGED: 'contact_changed', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', + GROUP_ADMIN_CHANGED: 'group_admin_changed', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', LOADING_SCREEN: 'loading_screen', @@ -200,7 +206,7 @@ exports.MessageAck = { diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 17abf6d..eb5aea6 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/InterfaceController.js + whatsapp-web.js 1.20.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -81,7 +81,9 @@ class InterfaceController { async openChatWindowAt(msgId) { await this.pupPage.evaluate(async msgId => { let msg = await window.Store.Msg.get(msgId); - await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg)); + let chat = await window.Store.Chat.find(msg.id.remote); + let searchContext = await window.Store.SearchContext(chat,msg); + await window.Store.Cmd.openChatAt(chat, searchContext); }, msgId); } @@ -101,7 +103,7 @@ class InterfaceController { */ async closeRightDrawer() { await this.pupPage.evaluate(async () => { - await window.Store.Cmd.closeDrawerRight(); + await window.Store.DrawerManager.closeDrawerRight(); }); } @@ -164,7 +166,7 @@ module.exports = InterfaceController; diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index ee2b4b4..e852f0b 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/Util.js + whatsapp-web.js 1.20.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@ module.exports = Util; diff --git a/package.json b/package.json index f272b46..e951c56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.20.0-alpha.0", + "version": "1.20.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts",