new Message()

Extends
Base

Properties

ack  MessageAck

ACK status for the message

author  string

If the message was sent to a group, this field will contain the user that sent the message.

body  string

Message content

broadcast  boolean

Indicates if the message was a broadcast

deviceType  string

String that represents from which device type the message was sent

forwardingScore  number

Indicates how many times the message was forwarded.

The maximum value is 127.

from  string

ID for the Chat that this message was sent to, except if the message was sent by the current user.

fromMe  boolean

Indicates if the message was sent by the current user

hasMedia  boolean

Indicates if the message has media available for download

hasQuotedMsg  boolean

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

id  object

ID that represents the message

inviteV4  object

Group Invite Data

isForwarded  boolean

Indicates if the message was forwarded

isStarred  boolean

Indicates if the message was starred

isStatus  boolean

Indicates if the message is a status update

Links included in the message.

location  Location

Location information contained in the message, if the message is type "location"

mediaKey  string

MediaKey that represents the sticker 'ID'

mentionedIds  Array of string

Indicates the mentions in the message body.

orderId  string

Order ID for message type ORDER

timestamp  number

Unix timestamp for when the message was created

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.

token  string

Order Token for message type ORDER

type  MessageTypes

Message type

vCards  Array of string

List of vCards contained in the message.

Methods

async

acceptGroupV4Invite() → Promise containing Object

Accept Group V4 Invite

Returns

Promise containing Object 

async

delete(everyone)

Deletes a message from the chat

Parameter

Name Type Optional Description

everyone

boolean

 

If true and the message is sent by the current user, will delete it for everyone in the chat.

Value can be null.

async

downloadMedia() → Promise containing MessageMedia

Downloads and returns the attatched message media

Returns

Promise containing MessageMedia 

async

forward(chat) → Promise

Forwards this message to another chat

Parameter

Name Type Optional Description

chat

(string or Chat)

 

Chat model or chat ID to which the message will be forwarded

Returns

Promise 

getChat() → Promise containing Chat

Returns the Chat this message was sent in

Returns

Promise containing Chat 

getContact() → Promise containing Contact

Returns the Contact this message was sent from

Returns

Promise containing Contact 

async

getInfo() → Promise containing nullable MessageInfo

Get information about message delivery status. May return null if the message does not exist or is not sent by you.

Returns

Promise containing nullable MessageInfo 

async

getMentions() → Promise containing Array of Contact

Returns the Contacts mentioned in this message

Returns

Promise containing Array of Contact 

async

getOrder() → Promise containing Order

Gets the order associated with a given message

Returns

Promise containing Order 

async

getQuotedMessage() → Promise containing Message

Returns the quoted message, if any

Returns

Promise containing Message 

async

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

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 Optional Description

content

(string, MessageMedia, or Location)

 

chatId

string

Yes

options

MessageSendOptions

Yes

Returns

Promise containing Message 

async

star()

Stars this message

async

unstar()

Unstars this message