Partager via


Channel class

A NotificationTarget that represents a team channel.

Remarks

It's recommended to get channels from ().

Constructors

Channel(TeamsBotInstallation_2, ChannelInfo)

Constructor.

Properties

info

Detailed channel information.

parent

The parent TeamsBotInstallation where this channel is created from.

type

Notification target type. For channel it's always "Channel".

Methods

sendAdaptiveCard(unknown, (context: TurnContext, error: Error) => Promise<void>)

Send an adaptive card message.

sendMessage(string, (context: TurnContext, error: Error) => Promise<void>)

Send a plain text message.

Constructor Details

Channel(TeamsBotInstallation_2, ChannelInfo)

Constructor.

new Channel(parent: TeamsBotInstallation_2, info: ChannelInfo)

Parameters

parent
TeamsBotInstallation

The parent TeamsBotInstallation where this channel is created from.

info

ChannelInfo

Detailed channel information.

Remarks

It's recommended to get channels from (), instead of using this constructor.

Property Details

info

Detailed channel information.

info: ChannelInfo

Property Value

ChannelInfo

parent

The parent TeamsBotInstallation where this channel is created from.

parent: TeamsBotInstallation_2

Property Value

type

Notification target type. For channel it's always "Channel".

type: NotificationTargetType

Property Value

Method Details

sendAdaptiveCard(unknown, (context: TurnContext, error: Error) => Promise<void>)

Send an adaptive card message.

function sendAdaptiveCard(card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>

Parameters

card

unknown

The adaptive card raw JSON.

onError

(context: TurnContext, error: Error) => Promise<void>

An optional error handler that can catch exceptions during adaptive card sending. If not defined, error will be handled by BotAdapter.onTurnError.

Returns

Promise<MessageResponse>

The response of sending adaptive card message.

sendMessage(string, (context: TurnContext, error: Error) => Promise<void>)

Send a plain text message.

function sendMessage(text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>

Parameters

text

string

The plain text message.

onError

(context: TurnContext, error: Error) => Promise<void>

An optional error handler that can catch exceptions during message sending. If not defined, error will be handled by BotAdapter.onTurnError.

Returns

Promise<MessageResponse>

The response of sending message.