Share via


ConversationsExtensions.CreateConversationAsync Method

Definition

Overloads

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)
CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

CreateConversation.

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

public static System.Threading.Tasks.Task<Microsoft.Bot.Connector.ConversationResourceResponse> CreateConversationAsync (this Microsoft.Bot.Connector.IConversations operations, Microsoft.Bot.Connector.ConversationParameters parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateConversationAsync : Microsoft.Bot.Connector.IConversations * Microsoft.Bot.Connector.ConversationParameters * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Connector.ConversationResourceResponse>
<Extension()>
Public Function CreateConversationAsync (operations As IConversations, parameters As ConversationParameters, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConversationResourceResponse)

Parameters

operations
IConversations
cancellationToken
CancellationToken

Returns

Applies to

CreateConversationAsync(IConversations, ConversationParameters, CancellationToken)

CreateConversation.

public static System.Threading.Tasks.Task<Microsoft.Bot.Schema.ConversationResourceResponse> CreateConversationAsync (this Microsoft.Bot.Connector.IConversations operations, Microsoft.Bot.Schema.ConversationParameters parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateConversationAsync : Microsoft.Bot.Connector.IConversations * Microsoft.Bot.Schema.ConversationParameters * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Bot.Schema.ConversationResourceResponse>
<Extension()>
Public Function CreateConversationAsync (operations As IConversations, parameters As ConversationParameters, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConversationResourceResponse)

Parameters

operations
IConversations

The operations group for this extension method.

parameters
ConversationParameters

Parameters to create the conversation from.

cancellationToken
CancellationToken

The cancellation token.

Returns

A new Conversation.

Remarks

Create a new Conversation.

POST to this method with a * Bot being the bot 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 bots initiating a direct message conversation. An example of how to do that would be:

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

.

Applies to