Share via


ActivityHandler.OnInvokeActivityAsync Method

Definition

Invoked when an invoke activity is received from the connector when the base behavior of OnTurnAsync(ITurnContext, CancellationToken) is used. Invoke activities can be used to communicate many different things. By default, this method will call OnSignInInvokeAsync(ITurnContext<IInvokeActivity>, CancellationToken) if the activity's name is signin/verifyState or signin/tokenExchange. A signin/verifyState or signin/tokenExchange invoke can be triggered by an OAuthCard.

protected virtual System.Threading.Tasks.Task<Microsoft.Bot.Builder.InvokeResponse> OnInvokeActivityAsync (Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IInvokeActivity> turnContext, System.Threading.CancellationToken cancellationToken);
abstract member OnInvokeActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IInvokeActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Builder.InvokeResponse>
override this.OnInvokeActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IInvokeActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Builder.InvokeResponse>
Protected Overridable Function OnInvokeActivityAsync (turnContext As ITurnContext(Of IInvokeActivity), cancellationToken As CancellationToken) As Task(Of InvokeResponse)

Parameters

turnContext
ITurnContext<IInvokeActivity>

A strongly-typed context object for this turn.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Remarks

When the OnTurnAsync(ITurnContext, CancellationToken) method receives an invoke activity, it calls this method. If the event Name is `signin/verifyState` or `signin/tokenExchange`, it calls OnSignInInvokeAsync(ITurnContext<IInvokeActivity>, CancellationToken) Invoke activities communicate programmatic commands from a client or channel to a bot. The meaning of an invoke activity is defined by the Name property, which is meaningful within the scope of a channel. A `signin/verifyState` or `signin/tokenExchange` invoke can be triggered by an OAuthCard or an OAuth prompt.

Applies to

See also