Class: Message

Message

A Message represents a Message in a Conversation.

Properties:
Name Type Description
author String The name of the user that sent Message
body String The body of the Message. Is null if Message is Media Message
attributes any Message custom attributes
conversation Conversation Conversation Message belongs to
dateCreated Date When Message was created
dateUpdated Date When Message was updated
index Number Index of Message in the Conversation's messages list By design of the conversations system the message indices may have arbitrary gaps between them, that does not necessarily mean they were deleted or otherwise modified - just that messages may have non-contiguous indices even if they are sent immediately one after another. Trying to use indices for some calculations is going to be unreliable. To calculate the number of unread messages it is better to use the read horizon API. See Conversation#getUnreadMessagesCount for details.
lastUpdatedBy String Identity of the last user that updated Message
media Media Contains Media information (if present)
participantSid String Authoring Participant's server-assigned unique identifier
sid String The server-assigned unique identifier for Message
type 'text' | 'media' Type of message: 'text' or 'media'
aggregatedDeliveryReceipt AggregatedDeliveryReceipt | null Aggregated information about Message delivery statuses across all Participants of a Conversation.
Fires:

Methods


getDetailedDeliveryReceipts()

Get delivery receipts of the message
Returns:
Type
Promise.<Array.<DetailedDeliveryReceipt>>

getParticipant()

Get Participant who is author of the Message
Returns:
Type
Promise.<Participant>

remove()

Remove the Message.
Returns:
Type
Promise.<Message>

updateAttributes(attributes)

Edit message attributes.
Parameters:
Name Type Description
attributes any new attributes for Message.
Returns:
Type
Promise.<Message>

updateBody(body)

Edit message body.
Parameters:
Name Type Description
body String new body of Message.
Returns:
Type
Promise.<Message>

Type Definitions


UpdateReason

The update reason for updated event emitted on Message
Type:
  • 'body' | 'lastUpdatedBy' | 'dateCreated' | 'dateUpdated' | 'attributes' | 'author' | 'deliveryReceipt'

Events


updated

Fired when the Message's properties or body has been updated.
Type: Object
Properties:
Name Type Description
message Message Updated Message
updateReasons Array.<Message#UpdateReason> Array of Message's updated event reasons