次の方法で共有


TeamsFxAdaptiveCardActionHandler interface

Interface for adaptive card action handler that can process card action invoke and return a response.

Properties

adaptiveCardResponse

Specify the behavior for how the card response will be sent in Teams conversation. The default value is AdaptiveCardResponse.ReplaceForInteractor, which means the card response will replace the current one only for the interactor.

triggerVerb

The verb defined in adaptive card action that can trigger this handler. The verb string here is case-insensitive.

Methods

handleActionInvoked(TurnContext, any)

The handler function that will be invoked when the action is fired.

Property Details

adaptiveCardResponse

Specify the behavior for how the card response will be sent in Teams conversation. The default value is AdaptiveCardResponse.ReplaceForInteractor, which means the card response will replace the current one only for the interactor.

adaptiveCardResponse?: AdaptiveCardResponse

Property Value

triggerVerb

The verb defined in adaptive card action that can trigger this handler. The verb string here is case-insensitive.

triggerVerb: string

Property Value

string

Method Details

handleActionInvoked(TurnContext, any)

The handler function that will be invoked when the action is fired.

function handleActionInvoked(context: TurnContext, actionData: any): Promise<InvokeResponse<any>>

Parameters

context

TurnContext

The turn context.

actionData

any

The contextual data that associated with the action.

Returns

Promise<InvokeResponse<any>>

A Promise representing a invoke response for the adaptive card invoke action. You can use the InvokeResponseFactory utility class to create an invoke response from

  • A text message:
return InvokeResponseFactory.textMessage("Action is processed successfully!");
  • An adaptive card:
    const responseCard = AdaptiveCards.declare(helloWorldCard).render(actionData);
    

return InvokeResponseFactory.adaptiveCard(responseCard);

- An error response:
 ```typescript
 return InvokeResponseFactory.errorResponse(InvokeResponseErrorCode.BadRequest, "Invalid request");
 ```

Remarks

For more details about the invoke response format, refer to https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/universal-action-model#response-format.