AdaptiveCardsActions class
A class to handle Adaptive Card actions such as executing actions, submitting actions, and performing searches.
Constructors
| Adaptive |
Constructs an instance of AdaptiveCardsActions. |
Methods
| action |
Registers a handler for the |
| action |
Registers a handler for the Action.Submit event. |
| search(string | Reg |
Registers a handler for the search event. |
Constructor Details
AdaptiveCardsActions<TState>(AgentApplication<TState>)
Constructs an instance of AdaptiveCardsActions.
new AdaptiveCardsActions(app: AgentApplication<TState>)
Parameters
- app
-
AgentApplication<TState>
The Teams application instance.
Method Details
actionExecute<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>)
Registers a handler for the Action.Execute event.
function actionExecute<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>): AgentApplication<TState>
Parameters
A string, RegExp, RouteSelector, or an array of these to match the action verb.
- handler
-
(context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>
A function to handle the action execution.
Returns
AgentApplication<TState>
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<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<void>)
Registers a handler for the Action.Submit event.
function actionSubmit<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<void>): AgentApplication<TState>
Parameters
A string, RegExp, RouteSelector, or an array of these to match the action verb.
- handler
-
(context: TurnContext, state: TState, data: TData) => Promise<void>
A function to handle the action submission.
Returns
AgentApplication<TState>
The Teams application instance.
search(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>)
Registers a handler for the search event.
function search(dataset: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>): AgentApplication<TState>
Parameters
A string, RegExp, RouteSelector, or an array of these to match the dataset.
- handler
-
(context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>
A function to handle the search query.
Returns
AgentApplication<TState>
The Teams application instance.