共用方式為


IChannelAdapter.CreateConversationAsync Method

Definition

Creates a conversation on the specified channel and executes a turn with the proper context for the new conversation.

public System.Threading.Tasks.Task CreateConversationAsync(string agentAppId, string channelId, string serviceUrl, string audience, Microsoft.Agents.Core.Models.ConversationParameters conversationParameters, Microsoft.Agents.Builder.AgentCallbackHandler callback, System.Threading.CancellationToken cancellationToken);
abstract member CreateConversationAsync : string * string * string * string * Microsoft.Agents.Core.Models.ConversationParameters * Microsoft.Agents.Builder.AgentCallbackHandler * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function CreateConversationAsync (agentAppId As String, channelId As String, serviceUrl As String, audience As String, conversationParameters As ConversationParameters, callback As AgentCallbackHandler, cancellationToken As CancellationToken) As Task

Parameters

agentAppId
String

The application ID of the Agent. For example, AgentClaims.GetAppId(ITurnContext.Identity)"

channelId
String

The ID for the channel. See Channels

serviceUrl
String

The channel's service URL endpoint.

audience
String

The audience for the connector. For example, AgentClaims.GetTokenAudience(ITurnContext.Identity)

conversationParameters
ConversationParameters

The conversation information to used to create the conversation.

callback
AgentCallbackHandler

The method to call for the resulting Agent turn.

cancellationToken
CancellationToken

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

Returns

Remarks

To start a conversation, your Agent must know its account information and the user's account information on that channel. Most channels only support initiating a direct message (non-group) conversation.

The adapter attempts to create a new conversation on the channel, and then sends a ActivityEventNames.CreateConversation Event Activity through its pipeline to the callback method.

If the conversation is established with the specified users, the ID of the activity's Conversation will contain the ID of the new conversation.

Applies to