/// <summary> /// SendToConversation /// </summary> /// This method allows you to send an activity to a conversation regardless of /// previous posts to a conversation. /// /// This is slightly different then ReplyToConversation(). /// * SendToConverstion(conversationId) - will simply append a message to the /// end of the conversation according to the timestamp or semantics of the /// channel /// * ReplyToConversation(conversationId,ActivityId) - models the semantics of /// threaded conversations, meaning it has the information necessary for the /// channel to reply to the actual message being responded to. /// /// SendToConversation is appropriate for the first message which initiates a /// conversation, or if you don't have a particular activity you are /// responding to. /// /// ReplyToConversation is preferable to SendToConversation() because it /// maintains threaded conversations. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='activity'> /// Activity to send /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <APIResponse> SendToConversationAsync(this IConversations operations, Activity activity, string conversationId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SendToConversationWithHttpMessagesAsync(activity, conversationId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public static async Task <ResourceResponse> SendToConversationAsync(this IConversations operations, string conversationId, Activity activity, Dictionary <string, List <string> > customHeaders, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SendToConversationWithHttpMessagesAsync(conversationId, activity, customHeaders, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// SendToConversation /// </summary> /// <remarks> /// This method allows you to send an activity to the end of a conversation. /// /// This is slightly different from ReplyToActivity(). /// * SendToConverstion(conversationId) - will append the activity to the end /// of the conversation according to the timestamp or semantics of the channel. /// * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply /// to another activity, if the channel supports it. If the channel does not /// support nested replies, ReplyToActivity falls back to SendToConversation. /// /// Use ReplyToActivity when replying to a specific activity in the /// conversation. /// /// Use SendToConversation in all other cases. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='activity'> /// Activity to send /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ResourceResponse> SendToConversationAsync(this IConversations operations, string conversationId, Activity activity, CancellationToken cancellationToken = default(CancellationToken)) { if (activity.Type == ActivityTypes.Trace && activity.ChannelId != "emulator") { return(new ResourceResponse(activity.Id ?? string.Empty)); } using (var _result = await operations.SendToConversationWithHttpMessagesAsync(conversationId, activity, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }