class ChatMessage

extends BaseChatMessage

Represents a message in a chat conversation.

Constructor

constructor(data, bot)

Parameters

data: ChatMessageData

Data used to construct the message.

bot: Bot

The active Bot instance.

Properties

id: string

The message's ID.

conversationId?: string

The ID of the conversation the message belongs to.

senderDid: `did:${string}`

The DID of the message's sender.

sentAt: Date

When the message was sent.

text: string

The message's text.

facets?: Facet[]

Annotations of text (mentions, URLs, hashtags, etc)

embed?: StrongRef

An embedded reference to a record.

Methods

getSender()

Fetch the profile of the user who sent this message.

getConversation()

Fetch the Conversation instance this message belongs to. Returns null if the conversation could not be found.

Returns

Promise<Conversation | null>

fromView(view, bot, conversationId?)

Constructs an instance from a MessageView.

Parameters

bot: Bot
conversationId?: string