Message

public final class Message

Message envelope class.

Contains general message properties (ID, sender, timestamp, etc.) and the message content body content.

  • General fields (ID, sender, timestamp, etc.) are stored in Message.

  • Specific content (text, image, etc.) is stored in content as a MessageContent subclass.

val message: Message = ...
when (val content = message.content) {
is TextMessage -> println("Text: ${content.text}")
is ImageMessage -> println("Image: ${content.remoteUrl}")
is FileMessage -> println("File: ${content.name}")
}

Parameters

channelIdentifier

Channel identifier containing channel type and channel ID

content

Message content body

Properties

Link copied to clipboard

Channel identifier containing channel type and channel ID.

Link copied to clipboard
private final Integer clientId

Auto-increment ID in the local database message table (client-side local ID).

Link copied to clipboard

Message content body.

Link copied to clipboard
private List<String> directedUserIds

Directed user ID list (only effective for group / community channels; null for direct channels).

Link copied to clipboard

Message direction (send / receive).

Link copied to clipboard
private final Boolean disableNotification

Whether push notification is disabled for this message.

Link copied to clipboard
private Boolean disableUpdateLastMessage

Whether to prevent this message from updating the channel's latest message.

Link copied to clipboard
private final Boolean hasChanged

Whether the message has been modified (community channel messages only).

Link copied to clipboard
private final Boolean isCounted

Whether this message is counted for unread count.

Link copied to clipboard
private final Boolean isPersisted

Whether this message is persisted in local storage.

Link copied to clipboard
private final Boolean isStatusMessage

Whether this is a status-only message (not stored or counted).

Link copied to clipboard
private final String messageId

Server-side unique message ID (globally unique within the same app).

Link copied to clipboard
private final String messageType

Message type identifier. See ai.nexconn.chat.message.model.MessageType for built-in types.

Link copied to clipboard
private Map<String, String> metadata

Message metadata in key-value format, supports remote sync.

Link copied to clipboard

Message modification info.

Link copied to clipboard
private Boolean needReceipt

Whether this message requires a read receipt.

Link copied to clipboard

Message received status info.

Link copied to clipboard
private String senderUserId

Sender user ID.

Link copied to clipboard
private final Boolean sentReceipt

Whether a read receipt has been sent for this message.

Link copied to clipboard

Message sending status.

Link copied to clipboard
private Long sentTime

Message sent time (Unix timestamp in milliseconds, server time).

Functions

Link copied to clipboard
public final Unit cancelDownloadingMedia(ErrorHandler handler)

Cancels the ongoing media download for this message.

Link copied to clipboard
public final Unit deleteMetadata(List<String> keys, ErrorHandler handler)

Removes message metadata by keys.

Link copied to clipboard

Downloads the media file attached to this message.

Link copied to clipboard

Channel identifier containing channel type and channel ID.

Link copied to clipboard
public final Integer getClientId()

Auto-increment ID in the local database message table (client-side local ID).

Link copied to clipboard
public final MessageContent getContent()

Message content body.

Link copied to clipboard
public final List<String> getDirectedUserIds()

Directed user ID list (only effective for group / community channels; null for direct channels).

Link copied to clipboard

Message direction (send / receive).

Link copied to clipboard
public final Boolean getDisableNotification()

Whether push notification is disabled for this message.

Link copied to clipboard
public final Boolean getDisableUpdateLastMessage()

Whether to prevent this message from updating the channel's latest message.

Link copied to clipboard
public final Boolean getHasChanged()

Whether the message has been modified (community channel messages only).

Link copied to clipboard
public final String getMessageId()

Server-side unique message ID (globally unique within the same app).

Link copied to clipboard
public final String getMessageType()

Message type identifier. See ai.nexconn.chat.message.model.MessageType for built-in types.

Link copied to clipboard
public final Map<String, String> getMetadata()

Message metadata in key-value format, supports remote sync.

Link copied to clipboard

Message modification info.

Link copied to clipboard
public final Boolean getNeedReceipt()

Whether this message requires a read receipt.

Link copied to clipboard

Message received status info.

Link copied to clipboard
public final String getSenderUserId()

Sender user ID.

Link copied to clipboard
public final Boolean getSentReceipt()

Whether a read receipt has been sent for this message.

Link copied to clipboard
public final SentStatus getSentStatus()

Message sending status.

Link copied to clipboard
public final Long getSentTime()

Message sent time (Unix timestamp in milliseconds, server time).

Link copied to clipboard
public final Boolean isCounted()

Whether this message is counted for unread count.

Link copied to clipboard
public final Boolean isPersisted()

Whether this message is persisted in local storage.

Link copied to clipboard
public final Boolean isStatusMessage()

Whether this is a status-only message (not stored or counted).

Link copied to clipboard
public final Unit pauseDownloadingMedia(ErrorHandler handler)

Pauses the ongoing media download for this message.

Link copied to clipboard
public final Unit requestSpeechToText(ErrorHandler handler)

Requests speech-to-text conversion for a voice message.

Link copied to clipboard
public final Unit requestStreamMessage(ErrorHandler handler)

Requests stream message content pulling.

Link copied to clipboard
public final Unit setContent(MessageContent content)

Message content body.

Link copied to clipboard
public final Unit setDirectedUserIds(List<String> directedUserIds)

Directed user ID list (only effective for group / community channels; null for direct channels).

Link copied to clipboard
public final Unit setDirection(MessageDirection direction)

Message direction (send / receive).

Link copied to clipboard
public final Unit setDisableUpdateLastMessage(Boolean disableUpdateLastMessage)

Whether to prevent this message from updating the channel's latest message.

Link copied to clipboard
public final Unit setMetadata(Map<String, String> metadata)

Message metadata in key-value format, supports remote sync.

public final Unit setMetadata(Map<String, String> metadata, ErrorHandler handler)

Updates message metadata.

Link copied to clipboard
public final Unit setModifyInfo(MessageModifyInfo modifyInfo)

Message modification info.

Link copied to clipboard
public final Unit setNeedReceipt(Boolean needReceipt)

Whether this message requires a read receipt.

Link copied to clipboard
public final Unit setReceivedStatusInfo(MessageReceivedStatusInfo receivedStatusInfo)

Message received status info.

public final Unit setReceivedStatusInfo(MessageReceivedStatusInfo receivedStatusInfo, OperationHandler<Boolean> handler)

Sets the received status of this message.

Link copied to clipboard
public final Unit setSenderUserId(String senderUserId)

Sender user ID.

Link copied to clipboard
public final Unit setSentStatus(SentStatus sentStatus)

Message sending status.

Link copied to clipboard
public final Unit setSentTime(Long sentTime)

Message sent time (Unix timestamp in milliseconds, server time).

Link copied to clipboard
public final Unit setSpeechToTextVisible(Boolean isVisible, ErrorHandler handler)

Sets the visibility of the speech-to-text result.

Link copied to clipboard
public String toString()