Usage and data structure
🚀 Usage​
Basic Example​
See Quick start above for the minimal setup. More examples - Slack-style messages, quick replies, custom components - live in the example directory.
📊 Data Structure​
Messages, system messages, and quick replies follow the structure defined in Models.ts.
Message object structure
interface IMessage {
_id: string | number
text: string
createdAt: Date | number
user: User
image?: string
video?: string
audio?: string
system?: boolean
sent?: boolean
received?: boolean
pending?: boolean
/** True while the text is still streaming in (shows a typing cursor) */
streaming?: boolean
quickReplies?: QuickReplies
replyMessage?: ReplyMessage
reactions?: MessageReaction[]
location?: {
latitude: number
longitude: number
}
}
interface ReplyMessage {
_id: string | number
text: string
user: User
image?: string
audio?: string
}
interface MessageReaction {
emoji: string
userIds: (string | number)[]
}
interface User {
_id: string | number
name?: string
avatar?: string | number | (() => React.ReactNode)
}