AdaptiveCardsActions class

A class to handle Adaptive Card actions such as executing actions, submitting actions, and performing searches.

Constructors

AdaptiveCardsActions(AgentApplication)

Constructs an instance of AdaptiveCardsActions.

Constructor Details

AdaptiveCardsActions(AgentApplication)

Constructs an instance of AdaptiveCardsActions.

new AdaptiveCardsActions(app: AgentApplication)

Parameters

app

AgentApplication

The Teams application instance.

Method Details

actionExecute(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => PromiseCard>)

Registers a handler for the Action.Execute event.

function actionExecute(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise): AgentApplication

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the action verb.

handler

(context: TurnContext, state: TState, data: TData) => Promise

A function to handle the action execution.

Returns

The Teams application instance.

Remarks

The delivery behavior depends on the action trigger and adaptiveCardsOptions.actionExecuteResponseType:

Response type Automatic trigger Manual trigger
REPLACE_FOR_INTERACTOR User response User response
REPLACE_FOR_ALL User response Shared update
NEW_MESSAGE_FOR_ALL User response New message
  • User response — Return an Adaptive Card invoke response only to the requesting or interacting user.
  • Shared update — Update the shared activity for all users and return an Adaptive Card invoke response to the interacting user.
  • New message — Send a new activity for all users and return a message acknowledgement to the interacting user.

Automatic refresh actions always return only an Adaptive Card invoke response. Updating or sending a refreshable card while processing an automatic refresh would cause Teams to invoke the refresh action again.

actionSubmit(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise)

Registers a handler for the Action.Submit event.

function actionSubmit(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise): AgentApplication

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the action verb.

handler

(context: TurnContext, state: TState, data: TData) => Promise

A function to handle the action submission.

Returns

The Teams application instance.

Registers a handler for the search event.

function search(dataset: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, query: Query) => Promise): AgentApplication

Parameters

dataset

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the dataset.

handler

(context: TurnContext, state: TState, query: Query) => Promise

A function to handle the search query.

Returns

The Teams application instance.