-
-
Notifications
You must be signed in to change notification settings - Fork 2
Added support for call to action responses #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🧪 Details on Ubuntu 24.04.2 LTSfrom dotnet-retest v0.7.1 on .NET 8.0.18 with 💜 by @devlooped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for sending interactive call-to-action (CTA) URL messages and related response handling across the WhatsApp client API and message abstractions.
- Introduces a new
SendCallToActionAsyncextension onIWhatsAppClientwith XML docs. - Adds
CallToActionhelper inMessageExtensionsand aCallToActionResponserecord with JSON polymorphic mapping. - Provides an integration test for CTA payloads in
WhatsAppClientTests.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/WhatsApp/WhatsAppClientExtensions.cs | New SendCallToActionAsync method and XML comments |
| src/WhatsApp/MessageExtensions.cs | Added CallToAction extension returning CallToActionResponse |
| src/WhatsApp/IMessage.cs | Registered CallToActionResponse for JSON deserialization |
| src/WhatsApp/CallToActionResponse.cs | Introduced CallToActionResponse record |
| src/Tests/WhatsAppClientTests.cs | Added SendsCallToActionAsync integration test |
Comments suppressed due to low confidence (3)
src/WhatsApp/WhatsAppClientExtensions.cs:560
- The
urlparameter is missing an<param>XML doc entry. Please add<param name="url">The URL the CTA button should open.</param>above the method.
public static Task<string?> SendCallToActionAsync(this IWhatsAppClient client, string serviceId, string userNumber, string message, string buttonText, string url, CancellationToken cancellation = default)
src/Tests/WhatsAppClientTests.cs:107
- [nitpick] The comment mentions "three buttons" but this CTA payload only includes a single URL button. Update the comment to accurately reflect the one-button CTA scenario.
// Send an interactive message with three buttons showcasing the payload/value
src/WhatsApp/WhatsAppClientExtensions.cs:560
- There are no unit tests covering
SendCallToActionAsync. Consider adding tests to verify that it constructs the correct payload and handles cancellation or error scenarios.
public static Task<string?> SendCallToActionAsync(this IWhatsAppClient client, string serviceId, string userNumber, string message, string buttonText, string url, CancellationToken cancellation = default)
src/WhatsApp/MessageExtensions.cs
Outdated
| /// <summary> | ||
| /// Sends an interactive call to action response to the user message. | ||
| /// </summary> | ||
| public static CallToActionResponse CallToAction(this IMessage message, string text, string buttonText, string url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick]
buttonText > action
add bool isReply = false to make it a reply (Context == message.Id) or leave it null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partially fixed with the action renaming for now. I'm not sure about the other one.
No description provided.