Constructor
Parameters
ThreadImplConfig
required
Returns
ThreadImpl
Properties
AsyncIterable<Message<unknown>>
required
Type:
MessageAsync iterator for all messages in the thread.
Messages are yielded in chronological order (oldest first).
Automatically handles pagination.string
required
Channel/conversation ID
required
The visibility scope of this channel
string
required
Unique ID
boolean
required
Whether this is a direct message conversation
AsyncIterable<Message<unknown>>
required
Type:
MessageIterate messages newest first (backward from most recent).
Auto-paginates lazily — only fetches pages as consumed.AbortSignal
required
Aborted when the platform or application stops the active turn.Pass this to AI/model APIs so cancellation stops upstream generation, not
only message delivery.
Promise<TState | null>
required
Get the current state.
Returns null if no state has been set.
Methods
WORKFLOW_DESERIALIZE
Parameters
required
Returns
ThreadImpl
WORKFLOW_SERIALIZE
Parameters
required
Returns
SerializedThread
createSentMessageFromMessage()
Parameters
Returns
SentMessage
fromJSON()
Parameters
required
Serialized thread data
ChatSingleton
Returns
ThreadImpl
getParticipants()
Returns
Author
Array of unique non-bot authors
isSubscribed()
Returns
Promise<boolean>
Promise resolving to true if subscribed, false otherwise
markAsRead()
Message or a message ID to target one explicitly;
a Message must belong to this thread.
Platforms may treat the receipt as a watermark and mark earlier messages
read along with the target.
Parameters
string | Message<unknown>
Type:
MessageMessage or message ID to acknowledge; defaults to the current messageReturns
Promise<void>
mentionUser()
Parameters
string
required
Returns
string
post()
Parameters
T
required
String, PostableMessage, JSX Card, or AsyncIterable
Returns
Promise<T>
A SentMessage with methods to edit, delete, or add reactions
Parameters
string | PostableRaw | PostableMarkdown | PostableAst | PostableCard | CardElem…
required
Type:
PostableRawPostableMarkdownPostableAstPostableCardCardElementTextElementImageElementDividerElementActionsElementSectionElementFieldsElementLinkElementTableElementChartElementModalElementCardJSXElementCardJSXPropsButtonElementLinkButtonElementFieldElementTextInputElementDateInputElementNumberInputElementSelectElementExternalSelectElementSelectOptionElementRadioSelectElementReturns
SentMessage
postEphemeral()
- Slack: Native ephemeral (session-dependent, disappears on reload)
- Google Chat: Native private message (persists, only target user sees it)
- Teams: Native targeted message (public preview)
- Discord: No native support - requires fallbackToDM: true
Parameters
string | Author
required
Type:
AuthorUser ID string or Author object (from message.author or event.user)string | PostableRaw | PostableMarkdown | PostableAst | PostableCard | CardElem…
required
Type:
PostableRawPostableMarkdownPostableAstPostableCardCardElementTextElementImageElementDividerElementActionsElementSectionElementFieldsElementLinkElementTableElementChartElementModalElementCardJSXElementCardJSXPropsButtonElementLinkButtonElementFieldElementTextInputElementDateInputElementNumberInputElementSelectElementExternalSelectElementSelectOptionElementRadioSelectElementMessage content (string, markdown, card, etc.). Streaming is not supported.required
Returns
EphemeralMessage
EphemeralMessage with usedFallback: true if DM was used, or null
if native ephemeral not supported and fallbackToDM is false
refresh()
recentMessages from the API.
Fetches the latest 50 messages and updates recentMessages.
Returns
Promise<void>
reply()
NotImplementedError on adapters without native reply support.
Parameters
string | Message<unknown>
required
Type:
MessageThe message to reply to, or its id. Prefer passing the
Message: it is checked against this thread, and it is carried through
to SentMessage.replyTo and cached thread history. A raw id is resolved
only if it matches a message this thread already holds (recentMessages
or the message being handled); otherwise the reply is still sent, but
replyTo is left undefined and no cross-thread check happens.string | PostableRaw | PostableMarkdown | PostableAst | PostableCard | CardElem…
required
Type:
PostableRawPostableMarkdownPostableAstPostableCardCardElementTextElementImageElementDividerElementActionsElementSectionElementFieldsElementLinkElementTableElementChartElementStreamChunkStreamEventModalElementCardJSXElementCardJSXPropsButtonElementLinkButtonElementFieldElementTextInputElementDateInputElementNumberInputElementSelectElementExternalSelectElementSelectOptionElementRadioSelectElementReply content. Streams are buffered and posted as one
message rather than streamed edit-by-edit.Returns
SentMessage
schedule()
Parameters
string | PostableRaw | PostableMarkdown | PostableAst | PostableCard | CardElem…
required
Type:
PostableRawPostableMarkdownPostableAstPostableCardCardElementTextElementImageElementDividerElementActionsElementSectionElementFieldsElementLinkElementTableElementChartElementModalElementCardJSXElementCardJSXPropsButtonElementLinkButtonElementFieldElementTextInputElementDateInputElementNumberInputElementSelectElementExternalSelectElementSelectOptionElementRadioSelectElementThe message content (streaming not supported){ postAt: Date }
required
Scheduling options including the target delivery time
Returns
ScheduledMessage
A ScheduledMessage with cancel() capability
setState()
Parameters
Partial<TState>
required
{ replace: boolean }
Returns
Promise<void>
startTyping()
Parameters
string
Returns
Promise<void>
subscribe()
onSubscribedMessage
handlers. DM threads route to onDirectMessage first when a direct
message handler is registered.
The initial message that triggered subscription will NOT fire the handler.
Returns
Promise<void>
toJSON()
Returns
SerializedThread
unsubscribe()
onSubscribedMessage handlers.
Returns
Promise<void>