Skip to main content
Chat SDK is fully typed with TypeScript. This page documents the core types and interfaces you’ll encounter when building with the SDK.

Message Types

Author

Information about a message author.
string
required
Platform-specific unique user ID
string
required
Username/handle for mentions
string
required
Display name
boolean | 'unknown'
required
Whether the author is a bot (or unknown if platform doesn’t provide this)
boolean
required
Whether the author is this bot instance

MessageMetadata

Message metadata like timestamps and edit status.

Attachment

File or media attachment.
'image' | 'file' | 'video' | 'audio'
required
Attachment type
() => Promise<Buffer>
Function to fetch attachment data with platform authentication
Use fetchData() for private attachments that require authentication (e.g., Slack private URLs).

FileUpload

File to upload with a message.

Event Types

ActionEvent

Fired when a user clicks a button in a card.

ReactionEvent

Fired when a user adds or removes a reaction.
EmojiValue
required
Normalized emoji as an EmojiValue singleton (enables === comparison)
string
required
Platform-specific emoji string (e.g., “+1” for Slack, ”👍” for GChat)
boolean
required
Whether the reaction was added (true) or removed (false)

SlashCommandEvent

Fired when a user invokes a slash command.
string
required
The slash command (e.g., “/help”)
string
required
Arguments after the command

ModalSubmitEvent

Fired when a user submits a modal form.
Record<string, string>
required
Form field values keyed by input ID
The thread where the modal was triggered (if from ActionEvent)
The message containing the button that opened the modal (if from ActionEvent)
The channel where the modal was triggered (if from SlashCommandEvent)

ModalCloseEvent

Fired when a user closes/cancels a modal (requires notifyOnClose: true).
Responses you can return from onModalSubmit handlers:

ModalErrorsResponse

Show validation errors on the modal.

ModalUpdateResponse

Update the modal with new content.

ModalPushResponse

Push a new modal onto the stack (Slack only).

ModalCloseResponse

Close the modal.

Fetch Types

FetchOptions

Options for fetching messages.
number
Maximum messages to fetch (default varies by adapter, typically 50-100)
string
Pagination cursor from previous FetchResult
'forward' | 'backward'
  • backward (default): Fetch most recent messages. Cursor moves to older messages.
  • forward: Fetch oldest messages. Cursor moves to newer messages.

FetchResult

Result of fetching messages.
Messages are always returned in chronological order (oldest first) within each page.

ThreadInfo

Thread metadata.

ChannelInfo

Channel metadata.

Emoji Types

EmojiValue

Immutable emoji value object with object identity.
These are singleton objects - the same emoji name always returns the same frozen object instance, enabling === comparison:

WellKnownEmoji

Type union of 80+ cross-platform emoji names:
See the emoji documentation for the complete list.

EmojiFormats

Platform-specific emoji formats.
Example:

Configuration Types

ChatConfig

Configuration for the Chat instance.
string
required
Default bot username across all adapters
Record<string, Adapter>
required
Map of adapter name to adapter instance
StateAdapter
required
State adapter for subscriptions and locking
number
default:"300000"
Message deduplication TTL in milliseconds (5 minutes)
number
default:"500"
Update interval for fallback streaming (post+edit) in milliseconds
string | null
default:"\"...\""
Placeholder text for fallback streaming. Set to null to wait for real text before posting.

WebhookOptions

Options for webhook handling.
(task: Promise<unknown>) => void
Function to run message handling in the background (e.g., Next.js after() or Vercel Functions waitUntil)

Error Types

ChatError

Base error class for Chat SDK errors.

RateLimitError

Thrown when rate limited by a platform.
number
Seconds until rate limit resets (if provided by platform)

LockError

Thrown when failing to acquire a lock.

NotImplementedError

Thrown when calling an unimplemented adapter feature.

Constants

THREAD_STATE_TTL_MS

Default TTL for thread state: 30 days in milliseconds.

See Also