Freigeben über


TeamsBotInstallation class

Warning

This API is now deprecated.

Use BotBuilderCloudAdapter.TeamsBotInstallation instead.

Constructors

TeamsBotInstallation(BotFrameworkAdapter, Partial<ConversationReference>)

Constructor

Properties

adapter

The bound BotFrameworkAdapter.

conversationReference

The bound ConversationReference.

type

Notification target type.

Methods

channels()

Get channels from this bot installation.

getTeamDetails()

Get team details from this bot installation

members()

Get members from this bot installation.

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

TeamsBotInstallation(BotFrameworkAdapter, Partial<ConversationReference>)

Constructor

new TeamsBotInstallation(adapter: BotFrameworkAdapter, conversationReference: Partial<ConversationReference>)

Parameters

adapter

BotFrameworkAdapter

the bound BotFrameworkAdapter.

conversationReference

Partial<ConversationReference>

the bound ConversationReference.

Remarks

It's recommended to get bot installations from <xref:ConversationBot.installations()>, instead of using this constructor.

Property Details

adapter

The bound BotFrameworkAdapter.

adapter: BotFrameworkAdapter

Property Value

BotFrameworkAdapter

conversationReference

The bound ConversationReference.

conversationReference: Partial<ConversationReference>

Property Value

Partial<ConversationReference>

type

Notification target type.

type?: NotificationTargetType

Property Value

Remarks

  • "Channel" means bot is installed into a team and notification will be sent to its "General" channel.
  • "Group" means bot is installed into a group chat.
  • "Person" means bot is installed into a personal scope and notification will be sent to personal chat.

Method Details

channels()

Get channels from this bot installation.

function channels(): Promise<Channel[]>

Returns

Promise<Channel[]>

an array of channels if bot is installed into a team, otherwise returns an empty array.

getTeamDetails()

Get team details from this bot installation

function getTeamDetails(): Promise<undefined | TeamDetails>

Returns

Promise<undefined | TeamDetails>

the team details if bot is installed into a team, otherwise returns undefined.

members()

Get members from this bot installation.

function members(): Promise<Member[]>

Returns

Promise<Member[]>

an array of members from where the bot is installed.

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.