Message Types

TypeScript type definitions for chat messages and threads used in the Intercom component.

Note: This documentation presents the essential fields developers need to work with the Deva SDK. Additional fields that are handled internally by the SDK are not shown here. The types shown reflect the most commonly used properties for building applications.


Message

Chat message with author and thread information.

Interface

type Message = {
  id: string;
  text: string;
  author_type: ChatMessageAuthor;
  persona: Persona;
  created_at: string;
  in_reply_to?: Message | null;
  thread_id: string;
  persona_id: string;
};

Fields

id: string

  • Unique message identifier

  • Used for referencing and replies

text: string

  • Message content

  • Supports plain text and markdown

author_type: ChatMessageAuthor

persona: Persona

  • Message sender's persona

  • Contains username, avatar, display_name

created_at: string

  • Message creation timestamp (ISO 8601)

  • Used for message ordering

in_reply_to: Message | null | undefined

  • Message being replied to

  • Recursive structure for threaded conversations

  • null for top-level messages

thread_id: string

  • ID of the chat thread

persona_id: string

  • ID of the message sender

Usage


Thread

Chat thread with member information.

Interface

Fields

id: string

  • Unique thread identifier

title: string

  • Thread display name

  • Auto-generated for DMs (e.g., "Alice, Bob")

members: Persona[]

  • Array of thread participants

  • Includes full persona information

is_direct_message: boolean

  • true for 1-on-1 chats

  • false for group threads

created_at: string

  • Thread creation timestamp (ISO 8601)

updated_at: string

  • Last modification timestamp (ISO 8601)

Usage

Used internally by the Intercom component:


PaginatedMessages

Paginated list of messages.

Interface

Fields

items: Message[]

  • Array of message objects

  • Ordered newest to oldest

  • Limited by pagination

total: number

  • Total message count in thread

  • Used for "load more" functionality

Usage

Used internally by the Intercom component:


ChatMessageAuthor

Enum for message author types.

Type

Values

"USER"

  • Message sent by human user

  • Regular chat messages

"BOT"

  • Message sent by AI deva

  • Deva responses in conversations

"SYSTEM"

  • System-generated message

  • Notifications and status updates

Usage


PostChatInput

Input type for creating chat messages.

Interface

Fields

text: string

  • Message content to send (required)

thread_id: string

  • ID of the thread to post in (required)

in_reply_to_id: string | undefined

  • ID of message being replied to (optional)

Usage

Used internally by the Intercom component:


ChatLLMQueryStreamTypes

Stream event types for real-time message streaming.

Type

Event Types

"content"

  • Partial text chunk during streaming

  • Sent multiple times as text generates

  • Accumulate chunks client-side

"response_message"

  • Complete message object

  • Sent once at end of stream

  • Contains full persisted message

"completion"

  • Stream completed successfully

  • No data payload

"error"

  • Stream encountered error

  • Contains error message

"llm_response"

  • Internal LLM processing event

Usage

Used internally by the Intercom streaming hook:


Type Relationships


Import


Last updated