Skip to main content

Interface: Message

api/model/message.Message

Properties

ack

ack: MessageAck

The acknolwedgement state of a message MessageAck


author

author: string


body

body: string

The body of the message. If the message type is chat , body will be the text of the chat. If the message type is some sort of media, then this body will be the thumbnail of the media.


broadcast

broadcast: boolean

If the message is sent as a broadcast


buttons

Optional buttons: Button[]

Buttons associated with the message


caption

caption: string

If the message is of a media type, it may also have a caption


chat

chat: Chat

The chat object


chatId

chatId: ChatId


clientUrl

clientUrl: string

Deprecated

Ironically, you should be using deprecatedMms3Url instead


cloudUrl

Optional cloudUrl: string

The URL of the file after being uploaded to the cloud using a cloud upload message preprocessor.


content

content: string


ctwaContext

Optional ctwaContext: Object

Type declaration

NameType
isSuspiciousLinkboolean
mediaTypenumber
sourceUrlstring
thumbnailstring

deprecatedMms3Url

deprecatedMms3Url: string


duration

Optional duration: string | number

The length of the media in the message, if it exists.


filePath

Optional filePath: string

When config.messagePreprocessor: "AUTO_DECRYPT_SAVE" is set, media is decrypted and saved on disk in a folder called media relative to the current working directory.

This is the filePath of the decrypted file.


filehash

Optional filehash: string

Used to checking the integrity of the decrypted media.


filename

Optional filename: string

The given filename of the file


from

from: ChatId

The chat from which the message was sent


fromMe

fromMe: boolean

If the message is from the host account


id

id: MessageId

The id of the message. Consists of the Chat ID and a unique string.

Example:

false_447123456789@c.us_7D914FEA78BE10277743F4B785045C37

invis

invis: boolean


isAnimated

isAnimated: boolean


isForwarded

isForwarded: boolean

If the message has been forwarded


isGroupJoinRequest

Optional isGroupJoinRequest: GroupChatId

When a user requests to join a group wihtin a community the request is received by the host as a message. This boolean will allow you to easily determine if the incoming message is a request to join a group.

If this is true then you need to determine within your own code whether or not to accept the user to the group which is indicated with quotedRemoteJid using addParticipant.


isGroupMsg

isGroupMsg: boolean


isMMS

isMMS: boolean


isMedia

isMedia: boolean


isNewMsg

isNewMsg: boolean


isNotification

isNotification: boolean


isPSA

isPSA: boolean


isQuotedMsgAvailable

isQuotedMsgAvailable: boolean

If this message is quoting (replying to) another message


isViewOnce

isViewOnce: boolean

Is the message a "view once" message


labels

labels: string[]

The labels associated with the message (used with business accounts)


lat

Optional lat: string

The latitude of a location message


list

Optional list: Object

The list associated with the list message

Type declaration

NameType
buttonTextstring
descriptionstring
sectionsSection[]
titlestring

listResponse

Optional listResponse: Row

List response associated with the message


lng

Optional lng: string

The longitude of a location message


loc

Optional loc: string

The text associated with a location message


mId

mId: string

The unique segment of the message id.

Example:

7D914FEA78BE10277743F4B785045C37

mediaData

mediaData: unknown


mentionedJidList

mentionedJidList: ContactId[]

An array of all mentioned numbers in this message.


mimetype

Optional mimetype: string


notifyName

notifyName: string


pollOptions

Optional pollOptions: PollOption[]

The options of a poll


quoteMap

quoteMap: QuoteMap

Use this to traverse the quote chain.


quotedMsg

Optional quotedMsg: Message


quotedMsgObj

Optional quotedMsgObj: Message


quotedParentGroupJid

Optional quotedParentGroupJid: GroupChatId

The parent group ID (community ID - communities are just groups made up of other groups) of the group represented by quotedRemoteJid


quotedRemoteJid

Optional quotedRemoteJid: string

The ID of the quoted group. Usually present when a user is requesting to join a group.


reactionByMe

Optional reactionByMe: ReactionSender

The reaction of the host account to this message


reactions

reactions: { aggregateEmoji: string ; hasReactionByMe: boolean ; id: string ; senders: ReactionSender[] }[]


recvFresh

recvFresh: boolean


selectedButtonId

selectedButtonId: string

The ID of the selected button


self

self: "in" | "out"

Indicates whether the message is coming into the session or going out of the session. You can have a message sent by the host account show as in when the message was sent from another session or from the host account device itself.


sender

sender: Contact

The contact object of the account that sent the message


senderId

Optional senderId: string

The ID of the message sender


shareDuration

shareDuration: number


star

star: boolean


stickerAuthor

Optional stickerAuthor: string


stickerPack

Optional stickerPack: string


t

t: number

The timestamp of the message


text

text: string

a convenient way to get the main text content from a message.


timestamp

timestamp: number

the timestanmp of the message


to

to: ChatId

The chat id to which the message is being sent


type

type: MessageTypes

The type of the message, see MessageTypes