TeamsBotInstallation class

A NotificationTarget that represents a bot installation. Teams Bot could be installed into

  • Personal chat
  • Group chat
  • Team (by default the General channel)

Remarks

It's recommended to get bot installations from <xref:ConversationBot.installations()>.

Constructors

TeamsBotInstallation(CloudAdapter, Partial<ConversationReference>, string)

Constructor

Properties

adapter

The bound CloudAdapter.

botAppId

The bot app id.

conversationReference

The bound ConversationReference.

type

Notification target type.

Methods

channels()

Get channels from this bot installation.

getPagedMembers(number, string)

Gets a pagined list of members 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(CloudAdapter, Partial<ConversationReference>, string)

Constructor

new TeamsBotInstallation(adapter: CloudAdapter, conversationReference: Partial<ConversationReference>, botAppId: string)

Parameters

adapter

CloudAdapter

The bound CloudAdapter.

conversationReference

Partial<ConversationReference>

The bound ConversationReference.

botAppId

string

The bot app id.

Remarks

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

Property Details

adapter

The bound CloudAdapter.

adapter: CloudAdapter

Property Value

CloudAdapter

botAppId

The bot app id.

botAppId: string

Property Value

string

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_2[]>

Returns

Promise<Channel[]>

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

getPagedMembers(number, string)

Gets a pagined list of members from this bot installation.

function getPagedMembers(pageSize?: number, continuationToken?: string): Promise<PagedData<Member_2>>

Parameters

pageSize

number

Suggested number of entries on a page.

continuationToken

string

A continuation token.

Returns

Promise<PagedData<Member>>

An array of members from where the bot is installed.

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()

Warning

This API is now deprecated.

Use getPagedMembers instead.

Get members from this bot installation.

function members(): Promise<Member_2[]>

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.