Abstract Class: BaseChannelAdapter<TAuthParams>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:79
Abstract base class that implements common IChannelAdapter behaviour. Concrete adapters (Telegram, Discord, IRC, ...) extend this class and implement the three abstract hooks:
doConnect(auth)-- establish the platform connection.doSendMessage(conversationId, content)-- deliver a message.doShutdown()-- tear down the platform connection.
Extended by
TelegramChannelAdapterDiscordChannelAdapterSlackChannelAdapterWhatsAppChannelAdapterWebChatChannelAdapterTwitterChannelAdapterRedditChannelAdapterIRCChannelAdapterSignalChannelAdapterTeamsChannelAdapterGoogleChatChannelAdapter
Type Parameters
TAuthParams
TAuthParams extends Record<string, string | undefined> = Record<string, string>
Shape of the platform-specific params object
inside ChannelAuthConfig. Defaults to Record<string, string>.
Implements
Constructors
Constructor
new BaseChannelAdapter<
TAuthParams>(retryConfig?):BaseChannelAdapter<TAuthParams>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:111
Parameters
retryConfig?
Partial<RetryConfig>
Returns
BaseChannelAdapter<TAuthParams>
Properties
auth
protectedauth:ChannelAuthConfig&object|undefined
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:97
Stored auth config so reconnect() can re-use it.
capabilities
abstractreadonlycapabilities: readonlyChannelCapability[]
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:87
Declared capabilities of this adapter.
Implementation of
connectedSince
protectedconnectedSince:string|undefined
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:92
displayName
abstractreadonlydisplayName:string
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:86
Human-readable display name (e.g., "WhatsApp Business").
Implementation of
errorMessage
protectederrorMessage:string|undefined
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:93
platform
abstractreadonlyplatform:ChannelPlatform
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:85
Platform this adapter serves.
Implementation of
platformInfo
protectedplatformInfo:Record<string,unknown> ={}
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:94
retryConfig
protectedreadonlyretryConfig:RetryConfig
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:101
status
protectedstatus:ChannelConnectionStatus='disconnected'
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:91
Methods
doConnect()
abstractprotecteddoConnect(auth):Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:124
Establish the platform connection using the supplied credentials.
Called by initialize after state has been set to connecting.
Must throw on failure — the base class handles retry and state changes.
Parameters
auth
ChannelAuthConfig & object
Returns
Promise<void>
doSendMessage()
abstractprotecteddoSendMessage(conversationId,content):Promise<ChannelSendResult>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:132
Deliver a message to the external platform.
Called by sendMessage only when the adapter is connected.
Parameters
conversationId
string
content
Returns
Promise<ChannelSendResult>
doShutdown()
abstractprotecteddoShutdown():Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:141
Release platform resources (close WebSocket, stop polling, etc.).
Called by shutdown before the state transitions to disconnected.
Returns
Promise<void>
emit()
protectedemit(event):void
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:265
Emit an event to all matching subscribers. Subclasses call this when the platform SDK receives an inbound event.
Parameters
event
Returns
void
emitConnectionChange()
protectedemitConnectionChange():void
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:296
Convenience helper: emit a connection_change event with the current
status. Called automatically by setStatus.
Returns
void
getConnectionInfo()
getConnectionInfo():
ChannelConnectionInfo
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:205
Get the current connection status and metadata.
Returns
Implementation of
IChannelAdapter.getConnectionInfo
hasCapability()
protectedhasCapability(cap):boolean
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:312
Check whether this adapter declares a specific capability.
Parameters
cap
Returns
boolean
initialize()
initialize(
auth):Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:151
Initialize the adapter with auth credentials. If already connected this will shut down the existing connection first (idempotent).
Parameters
auth
Returns
Promise<void>
Implementation of
on()
on(
handler,eventTypes?): () =>void
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:248
Register an event handler. Returns an unsubscribe function.
Parameters
handler
eventTypes?
Returns
():
void
Returns
void
Implementation of
reconnect()
reconnect():
Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:186
Manually trigger a reconnection attempt using stored credentials. Useful for UI-driven "reconnect" buttons.
Returns
Promise<void>
sendMessage()
sendMessage(
conversationId,content):Promise<ChannelSendResult>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:218
Send a message to a conversation on the external platform.
Parameters
conversationId
string
Platform-native conversation/chat ID.
content
Message content to send.
Returns
Promise<ChannelSendResult>
The platform-assigned message ID.
Implementation of
sendTypingIndicator()
sendTypingIndicator(
_conversationId,_isTyping):Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:234
Default stub — platforms that support typing indicators should override.
Parameters
_conversationId
string
_isTyping
boolean
Returns
Promise<void>
Implementation of
IChannelAdapter.sendTypingIndicator
setStatus()
protectedsetStatus(newStatus,error?):void
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:319
Transition to a new connection status and emit an event.
Parameters
newStatus
error?
string
Returns
void
shutdown()
shutdown():
Promise<void>
Defined in: packages/agentos/src/channels/adapters/BaseChannelAdapter.ts:166
Gracefully shut down the adapter and release all resources.
Returns
Promise<void>