Message class represents a chat message with structured formatting (mdast AST), metadata, attachments, and platform-specific raw data. It supports serialization for workflow engines.
Constructor
MessageData<TRawMessage>
required
Message data object
Message<TRawMessage>
Message instance
Properties
id
threadId
text
formatted
Use
stringifyMarkdown(message.formatted) from the chat package to convert the AST back to a markdown string.raw
author
Author
metadata
MessageMetadata
attachments
Attachment
isMention
This is set by the Chat SDK before passing the message to handlers. It checks for
@username in the message text using the adapter’s configured userName and optional botUserId.Methods
toJSON()
SerializedMessage
Serialized message with dates as ISO strings
Attachment
data (Buffer) and fetchData (function) are omitted as they’re not serializable.Static Methods
fromJSON()
SerializedMessage
required
Serialized message data
Message<TRawMessage>
Reconstructed Message instance
Type Parameters
unknown
default:"unknown"
Platform-specific raw message type
Usage Examples
Accessing Message Content
Checking for Mentions
Processing Attachments
Working with Formatted Content
Serialization for Workflows
Platform-Specific Data
See Also
- Chat API - Main Chat class
- Thread API - Thread interface
- Formatting - Markdown and AST formatting
- Attachments - Working with file attachments