From eaebc9a1f6d96a6d2b9f9161bfa041d4d4da2443 Mon Sep 17 00:00:00 2001 From: Drew Marsh Date: Wed, 16 Jan 2019 15:19:31 -0800 Subject: [PATCH 1/2] Adds ContinueConversationAsync to IAdapterIntegration Fixes #1287 --- .../Integration/IAdapterIntegration.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libraries/Microsoft.Bot.Builder/Integration/IAdapterIntegration.cs b/libraries/Microsoft.Bot.Builder/Integration/IAdapterIntegration.cs index 4fbb10b0c3..3bc021afa5 100644 --- a/libraries/Microsoft.Bot.Builder/Integration/IAdapterIntegration.cs +++ b/libraries/Microsoft.Bot.Builder/Integration/IAdapterIntegration.cs @@ -28,5 +28,26 @@ Task ProcessActivityAsync( Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken); + + /// + /// Sends a proactive message to a conversation. + /// + /// The application ID of the bot. This paramter is ignored in + /// single tenant the Adpters (Console, Test, etc) but is critical to the BotFrameworkAdapter + /// which is multi-tenant aware. + /// A reference to the conversation to continue. + /// The method to call for the resulting bot turn. + /// A cancellation token that can be used by other objects + /// or threads to receive notice of cancellation. + /// A task that represents the work queued to execute. + /// Call this method to proactively send a message to a conversation. + /// Most _channels require a user to initiate a conversation with a bot + /// before the bot can send activities to the user. + /// + Task ContinueConversationAsync( + string botId, + ConversationReference reference, + BotCallbackHandler callback, + CancellationToken cancellationToken = default(CancellationToken)); } } From e969604740b3d57640f125f5f8d16283b187c3ce Mon Sep 17 00:00:00 2001 From: Drew Marsh Date: Thu, 17 Jan 2019 10:47:01 -0800 Subject: [PATCH 2/2] Implement ContinueConversationAsync method in test projects The test projects contain an `IntercepterAdapter` class for demonstration purposes and those needed to implement the new `IAdapterIntegration::ContinueConversationAysnc` method. --- .../InteceptorAdapter.cs | 5 +++++ tests/Microsoft.Bot.Builder.TestBot/InteceptorAdapter.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/tests/Microsoft.Bot.Builder.TestBot.WebApi/InteceptorAdapter.cs b/tests/Microsoft.Bot.Builder.TestBot.WebApi/InteceptorAdapter.cs index 76a5f395ff..20f48588e3 100644 --- a/tests/Microsoft.Bot.Builder.TestBot.WebApi/InteceptorAdapter.cs +++ b/tests/Microsoft.Bot.Builder.TestBot.WebApi/InteceptorAdapter.cs @@ -17,6 +17,11 @@ public InteceptorAdapter(IAdapterIntegration innerAdapter) _innerAdapter = innerAdapter; } + public Task ContinueConversationAsync(string botId, ConversationReference reference, BotCallbackHandler callback, CancellationToken cancellationToken = default(CancellationToken)) + { + return _innerAdapter.ContinueConversationAsync(botId, reference, callback, cancellationToken); + } + public Task ProcessActivityAsync(string authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken) { return _innerAdapter.ProcessActivityAsync(authHeader, activity, callback, cancellationToken); diff --git a/tests/Microsoft.Bot.Builder.TestBot/InteceptorAdapter.cs b/tests/Microsoft.Bot.Builder.TestBot/InteceptorAdapter.cs index 249109efa6..e40deacb3c 100644 --- a/tests/Microsoft.Bot.Builder.TestBot/InteceptorAdapter.cs +++ b/tests/Microsoft.Bot.Builder.TestBot/InteceptorAdapter.cs @@ -17,9 +17,16 @@ public InteceptorAdapter(IAdapterIntegration innerAdapter) _innerAdapter = innerAdapter; } + public Task ContinueConversationAsync(string botId, ConversationReference reference, BotCallbackHandler callback, CancellationToken cancellationToken = default(CancellationToken)) + { + return _innerAdapter.ContinueConversationAsync(botId, reference, callback, cancellationToken); + } + public Task ProcessActivityAsync(string authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken) { return _innerAdapter.ProcessActivityAsync(authHeader, activity, callback, cancellationToken); } + + } }