Skip to main content

Class: TeamsChannelAdapter

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:104

Channel adapter for Microsoft Teams via Bot Framework.

Uses botbuilder and botframework-connector via dynamic imports.

Capabilities: text, rich_text, images, documents, buttons, threads, mentions, reactions, group_chat, channels.

Conversation ID format:

  • Direct: the conversation ID from Teams (opaque string)
  • Channel: <channelId> with optional replyToMessageId for threading

Extends​

Constructors​

Constructor​

new TeamsChannelAdapter(retryConfig?): TeamsChannelAdapter

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:111

Parameters​

retryConfig?​

Partial<RetryConfig>

Returns​

TeamsChannelAdapter

Inherited from​

BaseChannelAdapter.constructor

Properties​

auth​

protected auth: ChannelAuthConfig & object | undefined

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:97

Stored auth config so reconnect() can re-use it.

Inherited from​

BaseChannelAdapter.auth


capabilities​

readonly capabilities: readonly ChannelCapability[]

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:107

Declared capabilities of this adapter.

Overrides​

BaseChannelAdapter.capabilities


connectedSince​

protected connectedSince: string | undefined

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:92

Inherited from​

BaseChannelAdapter.connectedSince


displayName​

readonly displayName: "Microsoft Teams" = 'Microsoft Teams'

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:106

Human-readable display name (e.g., "WhatsApp Business").

Overrides​

BaseChannelAdapter.displayName


errorMessage​

protected errorMessage: string | undefined

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:93

Inherited from​

BaseChannelAdapter.errorMessage


platform​

readonly platform: ChannelPlatform = 'teams'

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:105

Platform this adapter serves.

Overrides​

BaseChannelAdapter.platform


platformInfo​

protected platformInfo: Record<string, unknown> = {}

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:94

Inherited from​

BaseChannelAdapter.platformInfo


retryConfig​

protected readonly retryConfig: RetryConfig

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:101

Inherited from​

BaseChannelAdapter.retryConfig


status​

protected status: ChannelConnectionStatus = 'disconnected'

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:91

Inherited from​

BaseChannelAdapter.status

Methods​

createConversation()​

createConversation(userId): Promise<string>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:375

Create a new conversation with a Teams user (proactive outreach).

Parameters​

userId​

string

The Teams user ID to start a conversation with.

Returns​

Promise<string>

The new conversation ID.


deleteMessage()​

deleteMessage(conversationId, messageId): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:326

Parameters​

conversationId​

string

messageId​

string

Returns​

Promise<void>


doConnect()​

protected doConnect(auth): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:146

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>

Overrides​

BaseChannelAdapter.doConnect


doSendMessage()​

protected doSendMessage(conversationId, content): Promise<ChannelSendResult>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:244

Deliver a message to the external platform. Called by sendMessage only when the adapter is connected.

Parameters​

conversationId​

string

content​

MessageContent

Returns​

Promise<ChannelSendResult>

Overrides​

BaseChannelAdapter.doSendMessage


doShutdown()​

protected doShutdown(): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:284

Release platform resources (close WebSocket, stop polling, etc.). Called by shutdown before the state transitions to disconnected.

Returns​

Promise<void>

Overrides​

BaseChannelAdapter.doShutdown


editMessage()​

editMessage(conversationId, messageId, content): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:307

Parameters​

conversationId​

string

messageId​

string

content​

MessageContent

Returns​

Promise<void>


emit()​

protected emit(event): void

Defined in: packages/agentos/src/io/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​

ChannelEvent

Returns​

void

Inherited from​

BaseChannelAdapter.emit


emitConnectionChange()​

protected emitConnectionChange(): void

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:296

Convenience helper: emit a connection_change event with the current status. Called automatically by setStatus.

Returns​

void

Inherited from​

BaseChannelAdapter.emitConnectionChange


getBotAdapter()​

getBotAdapter(): any

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:399

Get the Bot Framework adapter for advanced use cases. Returns undefined if botbuilder is not installed.

Returns​

any


getConnectionInfo()​

getConnectionInfo(): ChannelConnectionInfo

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:205

Get the current connection status and metadata.

Returns​

ChannelConnectionInfo

Inherited from​

BaseChannelAdapter.getConnectionInfo


hasCapability()​

protected hasCapability(cap): boolean

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:312

Check whether this adapter declares a specific capability.

Parameters​

cap​

ChannelCapability

Returns​

boolean

Inherited from​

BaseChannelAdapter.hasCapability


initialize()​

initialize(auth): Promise<void>

Defined in: packages/agentos/src/io/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​

ChannelAuthConfig

Returns​

Promise<void>

Inherited from​

BaseChannelAdapter.initialize


on()​

on(handler, eventTypes?): () => void

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:248

Register an event handler. Returns an unsubscribe function.

Parameters​

handler​

ChannelEventHandler

eventTypes?​

ChannelEventType[]

Returns​

(): void

Returns​

void

Inherited from​

BaseChannelAdapter.on


processIncomingActivity()​

processIncomingActivity(req, res): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:343

Process an incoming Bot Framework request (webhook handler). Call this from your HTTP endpoint that receives Teams webhook POSTs.

Parameters​

req​

HTTP request object.

body​

unknown

headers​

Record<string, string>

res​

HTTP response object.

status​

(code) => object

Returns​

Promise<void>


reconnect()​

reconnect(): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:186

Manually trigger a reconnection attempt using stored credentials. Useful for UI-driven "reconnect" buttons.

Returns​

Promise<void>

Inherited from​

BaseChannelAdapter.reconnect


sendMessage()​

sendMessage(conversationId, content): Promise<ChannelSendResult>

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:218

Send a message to a conversation on the external platform.

Parameters​

conversationId​

string

Platform-native conversation/chat ID.

content​

MessageContent

Message content to send.

Returns​

Promise<ChannelSendResult>

The platform-assigned message ID.

Inherited from​

BaseChannelAdapter.sendMessage


sendTypingIndicator()​

sendTypingIndicator(conversationId, _isTyping): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:294

Default stub — platforms that support typing indicators should override.

Parameters​

conversationId​

string

_isTyping​

boolean

Returns​

Promise<void>

Overrides​

BaseChannelAdapter.sendTypingIndicator


setStatus()​

protected setStatus(newStatus, error?): void

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:319

Transition to a new connection status and emit an event.

Parameters​

newStatus​

ChannelConnectionStatus

error?​

string

Returns​

void

Inherited from​

BaseChannelAdapter.setStatus


shutdown()​

shutdown(): Promise<void>

Defined in: packages/agentos/src/io/channels/adapters/BaseChannelAdapter.ts:166

Gracefully shut down the adapter and release all resources.

Returns​

Promise<void>

Inherited from​

BaseChannelAdapter.shutdown


storeConversationReference()​

storeConversationReference(conversationId, reference): void

Defined in: packages/agentos/src/io/channels/adapters/TeamsChannelAdapter.ts:362

Store a conversation reference for later proactive messaging. Typically called when first receiving a message from a conversation.

Parameters​

conversationId​

string

reference​

Record<string, unknown>

Returns​

void