ChatInstance
Constructor
Parameters
Type:
ChatConfigReturns
Chat
Properties
Unified History API. Sub-APIs:
history.user— cross-platform per-user transcript store (throws if not configured)history.thread— per-thread message listinghistory.channel— channel-level messages and thread listings
Cross-platform per-user transcript store. Deprecated alias for
ChatInstance.history.user — throws on access when user history
was not configured (
history.user or legacy transcripts + identity).Methods
abortTurn()
Parameters
Returns
Promise<void>
channel()
Parameters
Returns
Channel
A Channel that can be used to list threads, post messages, iterate messages, etc.
getAdapter()
Parameters
Returns
TAdapters[K]
getLogger()
Parameters
Returns
Logger
getSingleton()
Returns
Chat
getState()
Returns
StateAdapter
getUser()
users:read.email on Slack).
Parameters
Type:
AuthorPlatform-specific user ID string, or an Author objectReturns
UserInfo
User info, or null if user not found
getUserName()
Returns
string
handleIncomingMessage()
- Deduplication: Same message may arrive multiple times (e.g., Slack sends
both
messageandapp_mentionevents, GChat sends direct webhook + Pub/Sub) - Bot filtering: Messages from the bot itself are skipped
- Concurrency: Controlled by
concurrencyconfig (drop, queue, debounce, burst, concurrent)
Parameters
Returns
Promise<void>
hasSingleton()
Returns
boolean
initialize()
Returns
Promise<void>
onAction()
Parameters
onAgentSessionStopped()
Parameters
onAgentSessionTitleChanged()
Parameters
onAppContextChanged()
Parameters
onAppHomeOpened()
Parameters
onAssistantContextChanged()
Parameters
onAssistantThreadStarted()
Parameters
onDirectMessage()
onSubscribedMessage, onNewMention, and pattern handlers.
If no onDirectMessage handlers are registered, DMs continue through
normal routing. Unsubscribed DMs fall through to onNewMention for
backward compatibility.
Parameters
Type:
DirectMessageHandlerHandler called for DM messagesonInstalled()
Parameters
onMemberJoinedChannel()
Parameters
onMessageDeleted()
Parameters
onMessageUpdated()
onNewMessage, onNewMention, or onSubscribedMessage.
Parameters
Type:
MessageUpdatedHandleronModalClose()
notifyOnClose: true.
Parameters
onModalSubmit()
Parameters
onNewMention()
thread.subscribe()), subsequent messages
including @-mentions go to onSubscribedMessage handlers instead.
To detect mentions in subscribed threads, check message.isMention:
Parameters
Type:
MentionHandleronNewMessage()
Parameters
Type:
MessageHandlerHandler called when pattern matchesonOptionsLoad()
Parameters
onReaction()
Parameters
onSlashCommand()
/command in the message composer.
Use event.channel.post() or event.channel.postEphemeral() to respond.
Parameters
Type:
SlashCommandHandlerThe handler (if command filter is provided)onSubscribedMessage()
thread.subscribe().
This includes:
- Follow-up messages from users
- Messages that @-mention the bot (check
message.isMention)
- The message that triggered the subscription (e.g., the initial @mention)
- Messages sent by the bot itself
Parameters
Type:
SubscribedMessageHandleronUninstalled()
Parameters
openDM()
- Slack:
U...(e.g., “U00FAKEUSER1”) - Teams:
29:...(e.g., “29:198PbJuw…”) - Google Chat:
users/...(e.g., “users/100000000000000000001”) - Discord: numeric snowflake (e.g., “1033044521375764530”)
Parameters
Type:
AuthorPlatform-specific user ID string, or an Author objectReturns
Thread
A Thread that can be used to post messages
processAction()
Parameters
Type:
ActionEventAdapterType:
WebhookOptionsReturns
Promise<void>
processAgentSessionStopped()
Parameters
processAgentSessionTitleChanged()
Parameters
processAppContextChanged()
Parameters
processAppHomeOpened()
Parameters
processAssistantContextChanged()
Parameters
processAssistantThreadStarted()
Parameters
processInstalled()
Parameters
processMemberJoinedChannel()
Parameters
processMessage()
Parameters
Returns
Promise<void>
processMessageDeleted()
Parameters
Returns
Promise<void>
processMessageUpdated()
Parameters
Returns
Promise<void>
processModalClose()
Parameters
Type:
ModalCloseEventThe modal close event (without relatedThread/relatedMessage/relatedChannel)Webhook options
processModalSubmit()
Parameters
Type:
ModalSubmitEventThe modal submit event (without relatedThread/relatedMessage/relatedChannel)Webhook options
Returns
ModalResponse
processOptionsLoad()
Parameters
Returns
OptionsLoadResult
processReaction()
Parameters
Type:
ReactionEventAdapterReturns
Promise<void>
processSlashCommand()
Parameters
Type:
SlashCommandEventAdapterType:
WebhookOptionsReturns
Promise<void>
processUninstalled()
Parameters
registerSingleton()
Returns
this
reviver()
Returns
(key: string, value: unknown) => unknown
A reviver function for JSON.parse
shutdown()
Returns
Promise<void>
thread()
Parameters
Returns
Thread
A Thread that can be used to post messages, subscribe, etc.