Class: Message

Message

A Message represents a Message in a Channel.

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
channel Channel Channel Message belongs to
dateCreated Date When Message was created
dateUpdated Date When Message was updated
index Number Index of Message in the Channel's messages list
lastUpdatedBy String Identity of the last user that updated Message
media Media Contains Media information (if present)
memberSid String Authoring Member's server-assigned unique identifier
sid String The server-assigned unique identifier for Message
type 'text' | 'media' Type of message: 'text' or 'media'
Fires:

Methods


getMember()

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

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'

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