IConversations.CreateConversationAsync Method

Definition

CreateConversation.

public System.Threading.Tasks.Task<Microsoft.Agents.Connector.Types.ConversationResourceResponse> CreateConversationAsync(Microsoft.Agents.Core.Models.ConversationParameters parameters, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateConversationAsync : Microsoft.Agents.Core.Models.ConversationParameters * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Agents.Connector.Types.ConversationResourceResponse>
Public Function CreateConversationAsync (parameters As ConversationParameters, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConversationResourceResponse)

Parameters

parameters
ConversationParameters

Parameters to create the conversation from.

cancellationToken
CancellationToken

The cancellation token.

Returns

Remarks

Create a new Conversation.

POST to this method with a * Agent being the Agent creating the conversation * IsGroup set to true if this is not a direct message (default is false) * Array containing the members to include in the conversation

The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris.

Most channels only support the semantics of Agents initiating a direct message conversation. An example of how to do that would be:

var resource = await connector.conversations.CreateConversation(new
ConversationParameters(){ Agent = agent, members = new ChannelAccount[]
{ new ChannelAccount("user1") } );
await connect.Conversations.SendToConversationAsync(resource.Id,
new Activity() ... ) ;

.

Applies to