Provide seamless continuity between CLI and WhatsApp#186
Merged
Conversation
When not running in production, the new `UseConsole` can be used to support scenarios where the CLI falls short, such as sharing contacts, image or other media. In these cases, if the `UseConsole` is added after the `UseConversation` handler, you can get responses for messages in both WhatsApp as well as the CLI, provided a previous conversation in the time window came from the console (to establish its service url).
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new feature that enables seamless continuity between CLI and WhatsApp by incorporating the UseConsole option. The changes update responses (Typing, Text, and Reaction) to handle composite services, add a console handler for non‑production environments, and update sample and test code accordingly.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/WhatsApp/TypingResponse.cs | Adds support for CompositeService in typing responses. |
| src/WhatsApp/TextResponse.cs | Updates text response to send dual replies using a composite service when available. |
| src/WhatsApp/ReactionResponse.cs | Applies composite service logic to reaction responses. |
| src/WhatsApp/MessageExtensions.cs | Adjusts extension methods to incorporate the new overloads for composite services. |
| src/WhatsApp/ConsoleHandlerExtensions.cs | Introduces a new console handler extension for development scenarios. |
| src/WhatsApp/CompositeService.cs | Creates a new record for handling composite service scenarios. |
| src/Tests/WhatsAppClientTests.cs | Modifies tests to reflect updated ReplyAsync parameter ordering for composite service handling. |
| src/SampleApp/Sample/Program.cs | Updates sample app configuration to include the UseConsole middleware. |
| readme.md | Enhances documentation with instructions for using the new UseConsole feature. |
Comments suppressed due to low confidence (2)
src/WhatsApp/TextResponse.cs:25
- Invoking SendReplyAsync twice when a composite service is available results in two separate responses. Confirm that this dual-response behavior is intentional and consider adding documentation to clarify the design.
if (service != null)
src/Tests/WhatsAppClientTests.cs:59
- The parameter ordering in the ReplyAsync call has been updated to align with the new composite service behavior. Verify that this change is consistent with the updated API design and that the tests correctly reflect the intended message routing.
from,
Member
Author
🧪 Details on Ubuntu 24.04.2 LTSfrom dotnet-retest v0.7.1 on .NET 8.0.17 with 💜 by @devlooped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When not running in production, the new
UseConsolecan be used to support scenarios where the CLI falls short, such as sharing contacts, image or other media. In these cases, if theUseConsoleis added after theUseConversationhandler, you can get responses for messages in both WhatsApp as well as the CLI, provided a previous conversation in the time window came from the console (to establish its service url).