Rate this page:

Message

Describes single message. Received via the MessengerEvents.SendMessage or MessengerEvents.EditMessage events and used to serialize or edit the message.

Methods

remove

Copy URL
remove(): 

Promise<RemoveMessageEvent>

Remove the message from the conversation. Triggers the MessengerEvents.RemoveMessage event for all parties of the conversation (online participants and logged in clients). To get the result, use one of these options:

Returns

toCache

Copy URL
toCache(): 

SerializedMessage

Serialize the message so it can be stored (e.g. in IndexedDB) and later restored via the [Messenger2.createMessageFromCache] method

Returns

update

Copy URL
update(): 

Promise<EditMessageEvent>

Send text and payload changes to the cloud. Triggers the MessengerEvents.EditMessage event for all parties of the conversation (online participants and logged in clients). To get the result, use one of these options:

Returns

Props

conversation

Copy URL
conversation: 

string

The UUID of the conversation this message belongs to.

payload

Copy URL
payload: 

Object[]

Array of payload objects associated with the message. Setting this property does not send changes to the cloud. Use the Message.update method to send all the changes at once.

sender

Copy URL
sender: 

number

The id of the user who sent this message (see ConversationParticipant.userId).

text

Copy URL
text: 

string

Message text. Setting this property does not send changes to the cloud. Use the Message.update method to send all the changes at once.

uuid

Copy URL
uuid: 

string

The universally unique identifier (UUID) of the message. Can be used on client side for housekeeping.