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 Object Message custom attributes
channel Channel Channel Message belongs to
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
timestamp Date When Message was created
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|SessionError)>

updateAttributes(attributes)

Edit message attributes.
Parameters:
Name Type Description
attributes Object new attributes for Message.
Returns:
Type
Promise.<(Message|Error|SessionError)>

updateBody(body)

Edit message body.
Parameters:
Name Type Description
body String new body of Message.
Returns:
Type
Promise.<(Message|Error|SessionError)>

Type Definitions


UpdateReason

The update reason for updated event emitted on Message
Type:
  • 'body' | 'lastUpdatedBy' | 'dateUpdated' | 'timestamp' | '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