Skip to main content

Message

Represents a chat message with its content, status, and metadata.
export interface Message {
  id: string
  chatId: string
  authorId: string
  contentType: MessageContentType
  text?: string
  media?: MediaAttachment
  status: MessageStatus
  createdAt: string
  updatedAt?: string
  replyToId?: string
  isForwarded?: boolean
  reactions?: Reaction[]
}
id
string
required
Unique identifier for the message
chatId
string
required
ID of the chat this message belongs to
authorId
string
required
ID of the contact who sent the message
contentType
MessageContentType
required
Type of content in the message: "text", "image", or "audio"
text
string
Text content of the message (optional for media messages)
media
MediaAttachment
Media attachment if the message contains image or audio
status
MessageStatus
required
Current delivery status of the message
createdAt
string
required
ISO 8601 timestamp when the message was created
updatedAt
string
ISO 8601 timestamp when the message was last updated
replyToId
string
ID of the message this is replying to
isForwarded
boolean
Whether this message was forwarded from another chat
reactions
Reaction[]
Array of emoji reactions to this message

MessageStatus

Represents the delivery and read status of a message.
export type MessageStatus = "queued" | "sending" | "sent" | "delivered" | "read" | "error"
queued
string
Message is queued for sending
sending
string
Message is currently being sent
sent
string
Message has been sent to the server
delivered
string
Message has been delivered to the recipient
read
string
Message has been read by the recipient
error
string
Message failed to send

MessageContentType

Defines the types of content a message can contain.
export type MessageContentType = "text" | "image" | "audio"
text
string
Plain text message
image
string
Image attachment
audio
string
Audio message or voice note

MediaAttachment

Contains metadata and URLs for media files attached to messages.
export interface MediaAttachment {
  id: string
  type: "image" | "audio"
  url: string
  thumbnailUrl?: string
  width?: number
  height?: number
  sizeInBytes?: number
  caption?: string
  waveform?: number[]
  localObjectUrl?: string
}
id
string
required
Unique identifier for the attachment
type
'image' | 'audio'
required
Type of media file
url
string
required
Remote URL where the media file is stored
thumbnailUrl
string
URL for a thumbnail version of the media (typically for images)
width
number
Width in pixels (for images)
height
number
Height in pixels (for images)
sizeInBytes
number
File size in bytes
caption
string
Optional text caption for the media
waveform
number[]
Audio waveform data for visualization (for audio messages)
localObjectUrl
string
Local blob URL for client-side preview before upload

Reaction

Represents an emoji reaction to a message.
export interface Reaction {
  emoji: string
  authorId: string
  createdAt: string
}
emoji
string
required
The emoji used for the reaction
authorId
string
required
ID of the contact who added the reaction
createdAt
string
required
ISO 8601 timestamp when the reaction was added

Build docs developers (and LLMs) love