Extends
Members
ack :MessageAck
ACK status for the message
Type:
- Source:
author :string
If the message was sent to a group, this field will contain the user that sent the message.
Type:
- string
- Source:
body :string
Message content
Type:
- string
- Source:
broadcast :boolean
Indicates if the message was a broadcast
Type:
- boolean
- Source:
(nullable) caption :string
Raw caption, when WhatsApp stores one separately from body
Type:
- string
- Source:
(nullable) ctwaContext :object
Click-to-WhatsApp ad/referral context
Type:
- object
- Source:
deviceType :string
String that represents from which device type the message was sent
Type:
- string
- Source:
duration :string
Indicates the duration of the message in seconds
Type:
- string
- Source:
forwardingScore :number
Indicates how many times the message was forwarded.
The maximum value is 127.
Type:
- number
- Source:
from :string
ID for the Chat that this message was sent to, except if the message was sent by the current user.
Type:
- string
- Source:
fromMe :boolean
Indicates if the message was sent by the current user
Type:
- boolean
- Source:
groupMentions :Array.<GroupMention>
Indicates whether there are group mentions in the message body
Type:
- Array.<GroupMention>
- Source:
hasMedia :boolean
Indicates if the message has media available for download
Type:
- boolean
- Source:
hasQuotedMsg :boolean
Indicates if the message was sent as a reply to another message.
Type:
- boolean
- Source:
hasReaction :boolean
Indicates whether there are reactions to the message
Type:
- boolean
- Source:
id :object
ID that represents the message
Type:
- object
- Source:
(nullable) interactiveHeader :object
Header metadata for interactive messages
Type:
- object
- Source:
(nullable) interactivePayload :object
Payload for interactive messages
Type:
- object
- Source:
(nullable) interactiveType :string
Interactive message type
Type:
- string
- Source:
inviteV4 :object
Group Invite Data
Type:
- object
- Source:
isEphemeral :boolean
Indicates if the message will disappear after it expires
Type:
- boolean
- Source:
isForwarded :boolean
Indicates if the message was forwarded
Type:
- boolean
- Source:
isGif :boolean
Indicates whether the message is a Gif
Type:
- boolean
- Source:
isStarred :boolean
Indicates if the message was starred
Type:
- boolean
- Source:
isStatus :boolean
Indicates if the message is a status update
Type:
- boolean
- Source:
isViewOnce :boolean
Indicates if the message is a view once message
Type:
- boolean
- Source:
links :Array.<{link: string, isSuspicious: boolean}>
Links included in the message.
Type:
- Array.<{link: string, isSuspicious: boolean}>
- Source:
location :Location
Location information contained in the message, if the message is type "location"
Type:
- Source:
mediaKey :string
MediaKey that represents the sticker 'ID'
Type:
- string
- Source:
mentionedIds :Array.<string>
Indicates the mentions in the message body.
Type:
- Array.<string>
- Source:
(nullable) nativeFlowName :string
Native flow name for interactive messages
Type:
- string
- Source:
orderId :string
Order ID for message type ORDER
Type:
- string
- Source:
rawData :Object
Returns message in a raw format
Type:
- Object
- Source:
timestamp :number
Unix timestamp for when the message was created
Type:
- number
- Source:
to :string
ID for who this message is for.
If the message is sent by the current user, it will be the Chat to which the message is being sent. If the message is sent by another user, it will be the ID for the current user.
Type:
- string
- Source:
token :string
Order Token for message type ORDER
Type:
- string
- Source:
type :MessageTypes
Message type
Type:
- Source:
vCards :Array.<string>
List of vCards contained in the message.
Type:
- Array.<string>
- Source:
Methods
(async) acceptGroupV4Invite() → {Promise.<Object>}
Accept Group V4 Invite
- Source:
Returns:
- Type
- Promise.<Object>
(async) delete(everyonenullable, clearMediaopt, nullable)
Deletes a message from the chat
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
everyone |
boolean |
<nullable> |
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. |
|
clearMedia |
boolean |
<optional> <nullable> |
true | If true, any associated media will also be deleted from a device. |
- Source:
(async) downloadMedia() → {Promise.<(MessageMedia|undefined)>}
Downloads and returns the attached message media
- Source:
Returns:
- Type
- Promise.<(MessageMedia|undefined)>
(async) downloadMediaStream(optionsopt) → {Promise.<(MessageMediaStream|undefined)>}
Like downloadMedia(), but returns a Readable stream instead of loading the entire file into memory.
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Properties
|
- Source:
Returns:
undefined if media is unavailable
- Type
- Promise.<(MessageMediaStream|undefined)>
(async) edit(content, optionsopt) → {Promise.<?Message>}
Edits the current message.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
content |
string | ||
options |
MessageEditOptions |
<optional> |
Options used when editing the message |
- Source:
Returns:
- Type
- Promise.<?Message>
(async) editScheduledEvent(editedEventObject) → {Promise.<?Message>}
Edits the current ScheduledEvent message. Once the scheduled event is canceled, it can not be edited.
Parameters:
| Name | Type | Description |
|---|---|---|
editedEventObject |
ScheduledEvent |
- Source:
Returns:
- Type
- Promise.<?Message>
(async) forward(chat) → {Promise.<boolean>}
Forwards this message to another chat (that you chatted before, otherwise it will fail)
Parameters:
| Name | Type | Description |
|---|---|---|
chat |
string | Chat | Chat model or chat ID to which the message will be forwarded |
- Source:
Returns:
true when WhatsApp accepts the forward operation
- Type
- Promise.<boolean>
getChat() → {Promise.<Chat>}
Returns the Chat this message was sent in
- Source:
Returns:
- Type
- Promise.<Chat>
getContact() → {Promise.<Contact>}
Returns the Contact this message was sent from
- Source:
Returns:
- Type
- Promise.<Contact>
(async) getGroupMentions() → {Promise.<Array.<GroupChat>>}
Returns groups mentioned in this message
- Source:
Returns:
- Type
- Promise.<Array.<GroupChat>>
(async) getInfo() → {Promise.<?MessageInfo>}
Get information about message delivery status. May return null if the message does not exist or is not sent by you.
- Source:
Returns:
- Type
- Promise.<?MessageInfo>
(async) getMentions() → {Promise.<Array.<Contact>>}
Returns the Contacts mentioned in this message
- Source:
Returns:
- Type
- Promise.<Array.<Contact>>
(async) getOrder() → {Promise.<Order>}
Gets the order associated with a given message
- Source:
Returns:
- Type
- Promise.<Order>
(async) getPayment() → {Promise.<Payment>}
Gets the payment details associated with a given message
- Source:
Returns:
- Type
- Promise.<Payment>
(async) getPollVotes() → {Promise.<Array.<PollVote>>}
Returns the PollVote this poll message
- Source:
Returns:
- Type
- Promise.<Array.<PollVote>>
(async) getQuotedMessage() → {Promise.<Message>}
Returns the quoted message, if any
- Source:
Returns:
- Type
- Promise.<Message>
(async) getReactions() → {Promise.<Array.<ReactionList>>}
Gets the reactions associated with the given message
- Source:
Returns:
- Type
- Promise.<Array.<ReactionList>>
(async) pin(duration) → {Promise.<boolean>}
Pins the message (group admins can pin messages of all group members)
Parameters:
| Name | Type | Description |
|---|---|---|
duration |
number | The duration in seconds the message will be pinned in a chat |
- Source:
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) react(reaction) → {Promise}
React to this message with an emoji
Parameters:
| Name | Type | Description |
|---|---|---|
reaction |
string | Emoji to react with. Send an empty string to remove the reaction. |
- Source:
Returns:
- Type
- Promise
(async) reload() → {Promise.<Message>}
Reloads this Message object's data in-place with the latest values from WhatsApp Web. Note that the Message must still be in the web app cache for this to work, otherwise will return null.
- Source:
Returns:
- Type
- Promise.<Message>
(async) reply(content, chatIdopt, optionsopt) → {Promise.<(Message|null|undefined)>}
Sends a message as a reply to this message. If chatId is specified, it will be sent through the specified Chat. If not, it will send the message in the same Chat as the original message was sent.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
content |
string | MessageMedia | Location | ||
chatId |
string |
<optional> |
|
options |
MessageSendOptions |
<optional> |
- Source:
Returns:
- Type
- Promise.<(Message|null|undefined)>
(async) star()
Stars this message
- Source:
(async) unpin() → {Promise.<boolean>}
Unpins the message (group admins can unpin messages of all group members)
- Source:
Returns:
Returns true if the operation completed successfully, false otherwise
- Type
- Promise.<boolean>
(async) unstar()
Unstars this message
- Source:
(async) vote(selectedOptions) → {Promise}
Send votes to the poll message
Parameters:
| Name | Type | Description |
|---|---|---|
selectedOptions |
Array.<string> | Array of options selected. |
- Source:
Returns:
- Type
- Promise