Options
All
  • Public
  • Public/Protected
  • All
Menu

A message in a channel.

Hierarchy

  • ReplayEventEmitter<MessageEvents>
    • Message

Index

Properties

Readonly channel

channel: Channel

Channel that the message is in.

Static Readonly updated

updated: "updated" = 'updated'

Fired when the properties or the body of the message have been updated.

Parameters:

  1. object data - info object provided with the event. It has the following properties:

Accessors

attributes

  • get attributes(): Object
  • Custom attributes of the message.

    Returns Object

author

  • get author(): string
  • Name of the user that sent the message.

    Returns string

body

  • get body(): string
  • Body of the message. Null if the message is a media message.

    Returns string

dateCreated

  • get dateCreated(): Date
  • Date this message was created on.

    Returns Date

dateUpdated

  • get dateUpdated(): Date
  • Date this message was last updated on.

    Returns Date

index

  • get index(): number
  • Index of the message in the channel's messages list. By design of the Programmable Chat 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 some non-contiguous indices even if they are being 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 Channel.getUnconsumedMessagesCount for details.

    Returns number

lastUpdatedBy

  • get lastUpdatedBy(): string
  • Identity of the last user that updated the message.

    Returns string

media

  • Media information (if present).

    Returns Media

memberSid

  • get memberSid(): string
  • The server-assigned unique identifier of the authoring member.

    Returns string

sid

  • get sid(): string
  • The server-assigned unique identifier for the message.

    Returns string

type

  • Push notification type of the message.

    Returns MessageType

Methods

getMember

  • getMember(): Promise<Member>
  • Get the member who is the author of the message.

    Returns Promise<Member>

remove

  • Remove the message.

    Returns Promise<Message>

updateAttributes

  • updateAttributes(attributes: any): Promise<Message>
  • Edit the message attributes.

    Parameters

    • attributes: any

      New attributes.

    Returns Promise<Message>

updateBody

  • updateBody(body: string): Promise<Message>
  • Edit the message body.

    Parameters

    • body: string

      New body of the message.

    Returns Promise<Message>