TurnContext.SendActivityAsync Method

Definition

Overloads

SendActivityAsync(IActivity, CancellationToken)

Sends an activity to the sender of the incoming activity.

SendActivityAsync(String, String, String, CancellationToken)

Sends a message activity to the sender of the incoming activity.

SendActivityAsync(IActivity, CancellationToken)

Sends an activity to the sender of the incoming activity.

public System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse> SendActivityAsync (Microsoft.Bot.Schema.IActivity activity, System.Threading.CancellationToken cancellationToken = default);
abstract member SendActivityAsync : Microsoft.Bot.Schema.IActivity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse>
override this.SendActivityAsync : Microsoft.Bot.Schema.IActivity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse>
Public Function SendActivityAsync (activity As IActivity, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse)

Parameters

activity
IActivity

The activity to send.

cancellationToken
CancellationToken

Cancellation token.

Returns

A task that represents the work queued to execute.

Implements

Exceptions

activity is null.

Remarks

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

Applies to

SendActivityAsync(String, String, String, CancellationToken)

Sends a message activity to the sender of the incoming activity.

public System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse> SendActivityAsync (string textReplyToSend, string speak = default, string inputHint = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SendActivityAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse>
override this.SendActivityAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ResourceResponse>
Public Function SendActivityAsync (textReplyToSend As String, Optional speak As String = Nothing, Optional inputHint As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse)

Parameters

textReplyToSend
String

The text of the message to send.

speak
String

Optional, text to be spoken by your bot on a speech-enabled channel.

inputHint
String

Optional, indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client. One of: "acceptingInput", "ignoringInput", or "expectingInput". Default is null.

cancellationToken
CancellationToken

The cancellation token.

Returns

A task that represents the work queued to execute.

Implements

Exceptions

textReplyToSend is null or whitespace.

Remarks

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

See the channel's documentation for limits imposed upon the contents of textReplyToSend.

To control various characteristics of your bot's speech such as voice, rate, volume, pronunciation, and pitch, specify speak in Speech Synthesis Markup Language (SSML) format.

Applies to