Core Classes
Chat
Main entry point for creating chat bots with handlers and webhooks
Thread
Represents a conversation thread with message posting and state management
Channel
Represents a channel/conversation container that holds threads
Message
A chat message with metadata, formatting, and attachments
Quick Start
Type Safety
The Chat SDK is fully type-safe with TypeScript. Use generics to define custom state types:Architecture
Thread ID Format
All thread IDs follow the pattern:{adapter}:{channel}:{thread}
- Slack:
slack:C123ABC:1234567890.123456 - Teams:
teams:{base64(conversationId)}:{base64(serviceUrl)} - Google Chat:
gchat:spaces/ABC123:{base64(threadName)}
Message Flow
- Platform sends webhook to
/api/webhooks/{platform} - Adapter verifies request and parses message
- Chat acquires lock on thread
- Checks subscription status and calls appropriate handlers
- Handlers receive Thread and Message objects
State Management
Thread and channel state is stored in the StateAdapter with:- 30-day TTL by default
- Merge-by-default (use
{ replace: true }to override) - Per-thread and per-channel namespaces
See Also
- Event Handlers - Message, action, and reaction handlers
- Webhooks - Setting up platform webhooks
- State Management - Thread and channel state
- Formatting - Markdown and rich formatting