Options
All
  • Public
  • Public/Protected
  • All
Menu

A message in a conversation.

Hierarchy

  • ReplayEventEmitter<MessageEvents>
    • Message

Index

Properties

Readonly conversation

conversation: Conversation

Conversation that the message is in.

Static Readonly updated

updated: "updated" = "updated"

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

Parameters:

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

Accessors

aggregatedDeliveryReceipt

  • Aggregated information about the message delivery statuses across all participants of a conversation..

    Returns AggregatedDeliveryReceipt

attachedMedia

  • get attachedMedia(): Media[]
  • Return all media attachments, except email body/history attachments, without temporary urls.

    Returns Media[]

attributes

  • Custom attributes of the message.

    Returns JSONValue

author

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

    Returns string

body

  • get body(): string
  • Body of the message.

    Returns string

contentSid

  • get contentSid(): 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 this message in the conversation's list of messages.

    By design, 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 Conversation.getUnreadMessagesCount for details.

    Returns number

lastUpdatedBy

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

    Returns string

media

  • One of the attached media (if present).

    deprecated

    Use attachedMedia instead. Note that the latter is now an array.

    Returns Media

participantSid

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

    Returns string

sid

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

    Returns string

subject

  • get subject(): string
  • Message subject. Used only in email conversations.

    Returns string

type

Methods

getChannelMetadata

getContentData

getDetailedDeliveryReceipts

getEmailBody

  • getEmailBody(type?: string): Media
  • Get a media descriptor for an email body attachment of a provided type. Allowed body types are returned in the Conversation.limits().emailBodiesAllowedContentTypes array.

    Parameters

    • type: string = "text/plain"

      Type of email body to request, defaults to text/plain.

    Returns Media

getEmailHistory

  • getEmailHistory(type?: string): Media
  • Get a media descriptor for an email history attachment of a provided type. Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedContentTypes array.

    Parameters

    • type: string = "text/plain"

      Type of email history to request, defaults to text/plain.

    Returns Media

getMediaByCategories

  • getMediaByCategories(categories: MediaCategory[]): Media[]
  • Return a (possibly empty) array of media matching a specific set of categories. Allowed category is so far only 'media'.

    Parameters

    • categories: MediaCategory[]

      Array of categories to match.

    Returns Media[]

    Array of media descriptors matching given categories.

getParticipant

  • Get the participant who is the author of the message.

    Returns Promise<Participant>

getTemporaryContentUrlsForAttachedMedia

  • Get content URLs for all media attached to the message.

    Returns CancellablePromise<Map<string, string>>

getTemporaryContentUrlsForMedia

  • Get content URLs for all media attachments in the given set using a single operation.

    Parameters

    • contentSet: Media[]

      Set of media attachments to query content URLs.

    Returns CancellablePromise<Map<string, string>>

getTemporaryContentUrlsForMediaSids

  • getTemporaryContentUrlsForMediaSids(mediaSids: string[]): CancellablePromise<Map<string, string>>
  • Get content URLs for all media attachments in the given set of media sids using a single operation.

    Parameters

    • mediaSids: string[]

      Set of media sids to query for the content URL.

    Returns CancellablePromise<Map<string, string>>

remove

  • Remove the message.

    Returns Promise<Message>

updateAttributes

  • Edit the message attributes.

    Parameters

    Returns Promise<Message>

updateBody

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

    Parameters

    • body: string

      New body of the message.

    Returns Promise<Message>