Skip to main content

onTextMessageReceived

Triggers when a new text message arrives in a conversation.
Use it to process, reply to, or analyze incoming messages.

Received properties​

Apart from Base, Ephemeral, and Replyable properties, a WireMessage.Text (JVM) / TextMessage (Typescript) object contains the following fields:

NameDescription
textThe message content.
mentionsList of mentions in the message. Empty if none.
quotedMessageIdID of the message being quoted, if it's a reply.
quotedMessageSha256SHA-256 hash of the quoted message, required if quotedMessageId is present.
linkPreviewsList of link previews generated from URLs in the message. Empty if none.

Sample usage​

Echo received message​

override suspend fun onTextMessageReceived(wireMessage: WireMessage.Text) {
val message = WireMessage.Text.create(
conversationId = wireMessage.conversationId,
text = wireMessage.text
)
manager.sendMessageSuspending(message = message)
}