Conversation.SendAsync Method

Definition

Process an incoming message within the conversation.

public static System.Threading.Tasks.Task SendAsync (Microsoft.Bot.Connector.IMessageActivity toBot, Func<Microsoft.Bot.Builder.Dialogs.IDialog<object>> MakeRoot, System.Threading.CancellationToken token = default);
static member SendAsync : Microsoft.Bot.Connector.IMessageActivity * Func<Microsoft.Bot.Builder.Dialogs.IDialog<obj>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function SendAsync (toBot As IMessageActivity, MakeRoot As Func(Of IDialog(Of Object)), Optional token As CancellationToken = Nothing) As Task

Parameters

toBot
IMessageActivity

The message sent to the bot.

MakeRoot
Func<IDialog<Object>>

The factory method to make the root dialog.

token
CancellationToken

The cancellation token.

Returns

A task that represents the message to send inline back to the user.

Remarks

This method: 1. Instantiates and composes the required components. 2. Deserializes the dialog state (the dialog stack and each dialog's state) from the toBotIMessageActivity. 3. Resumes the conversation processes where the dialog suspended to wait for a IMessageActivity. 4. Queues IMessageActivitys to be sent to the user. 5. Serializes the updated dialog state in the messages to be sent to the user.

The MakeRoot factory method is invoked for new conversations only, because existing conversations have the dialog stack and state serialized in the IMessageActivity data.

Applies to