Proactive.SendActivityAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| SendActivityAsync(IChannelAdapter, Conversation, IActivity, CancellationToken) |
Sends an activity to a conversation using the specified channel adapter and conversation reference. |
| SendActivityAsync(IChannelAdapter, String, IActivity, CancellationToken) |
Sends an activity to an existing conversation using the specified channel adapter. |
SendActivityAsync(IChannelAdapter, Conversation, IActivity, CancellationToken)
Sends an activity to a conversation using the specified channel adapter and conversation reference.
public static System.Threading.Tasks.Task<Microsoft.Agents.Core.Models.ResourceResponse> SendActivityAsync(Microsoft.Agents.Builder.IChannelAdapter adapter, Microsoft.Agents.Builder.App.Proactive.Conversation conversation, Microsoft.Agents.Core.Models.IActivity activity, System.Threading.CancellationToken cancellationToken = default);
static member SendActivityAsync : Microsoft.Agents.Builder.IChannelAdapter * Microsoft.Agents.Builder.App.Proactive.Conversation * Microsoft.Agents.Core.Models.IActivity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Agents.Core.Models.ResourceResponse>
Public Shared Function SendActivityAsync (adapter As IChannelAdapter, conversation As Conversation, activity As IActivity, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse)
Parameters
- adapter
- IChannelAdapter
The channel adapter used to send the activity. Cannot be null.
- conversation
- Conversation
Instance of a Conversation. This can be created with Conversation constructors or ConversationBuilder.
- activity
- IActivity
The activity to send to the conversation. If the activity's Type property is null or empty, it defaults to a message activity. Cannot be null.
- cancellationToken
- CancellationToken
A cancellation token that can be used to cancel the send operation.
Returns
A task that represents the asynchronous operation. The task result contains a ResourceResponse with information about the sent activity.
Applies to
SendActivityAsync(IChannelAdapter, String, IActivity, CancellationToken)
Sends an activity to an existing conversation using the specified channel adapter.
public System.Threading.Tasks.Task<Microsoft.Agents.Core.Models.ResourceResponse> SendActivityAsync(Microsoft.Agents.Builder.IChannelAdapter adapter, string conversationId, Microsoft.Agents.Core.Models.IActivity activity, System.Threading.CancellationToken cancellationToken = default);
member this.SendActivityAsync : Microsoft.Agents.Builder.IChannelAdapter * string * Microsoft.Agents.Core.Models.IActivity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Agents.Core.Models.ResourceResponse>
Public Function SendActivityAsync (adapter As IChannelAdapter, conversationId As String, activity As IActivity, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse)
Parameters
- adapter
- IChannelAdapter
The channel adapter used to send the activity. Cannot be null.
- conversationId
- String
The unique identifier of the conversation to which the activity will be sent. Cannot be null or empty. The conversation must have been stored using StoreConversationAsync(ITurnContext, CancellationToken)
- activity
- IActivity
The activity to send to the conversation. Must not be null. If the activity's Type property is null or empty, it defaults to a message activity.
- cancellationToken
- CancellationToken
A cancellation token that can be used to cancel the send operation.
Returns
A task that represents the asynchronous operation. The task result contains a ResourceResponse with the ID of the sent activity.
Exceptions
Thrown if no conversation reference is found for the specified conversation ID.