feat: add Vonage Messages API adapter#111
feat: add Vonage Messages API adapter#111bhardwajparth51 wants to merge 5 commits intoutopia-php:mainfrom
Conversation
Greptile SummaryThis PR adds a new Key observations:
Confidence Score: 5/5This PR is safe to merge; all previously raised P0/P1 concerns have been addressed and no new critical issues were found. Both prior P1 issues (null No files require special attention. Important Files Changed
Reviews (5): Last reviewed commit: "fix: move from field trimming before emp..." | Re-trigger Greptile |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughAdds a new SMS adapter 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/Messaging/Adapter/SMS/VonageMessagesTest.php (1)
30-34: Inconsistent handling ofVONAGE_FROMbetween constructor and message.The constructor fallback (line 27) uses
'Vonage'whenVONAGE_FROMis unset, but the message'sfrom(line 33) receivesfalse(fromgetenv()returning false). This creates an inconsistent test scenario where the adapter'sfromdiffers from the message'sfrom.If the intent is to test the adapter's constructor
fromtaking precedence, the message'sfromcould be explicitly set tonullor omitted. If the intent is to pass matching values, both should use the same fallback.♻️ Suggested clarification
$message = new SMS( to: [$to], content: 'Test Content', - from: \getenv('VONAGE_FROM') + from: \getenv('VONAGE_FROM') ?: null );
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e6eed56d-cd95-4c22-9ff3-18c201ec0c9c
📒 Files selected for processing (3)
src/Utopia/Messaging/Adapter/SMS/VonageMessages.phpsrc/Utopia/Messaging/Adapter/VonageMessagesBase.phptests/Messaging/Adapter/SMS/VonageMessagesTest.php
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@stnguyen90 Ready for review! let me know if it need any additional changes. |
|
i think the CI failures are all pre-existing they're coming from expired or missing github secrets for Twilio, Resend, Sendgrid, Mailgun, Fast2SMS, Inforu, Discord, APNS, and FCM. My Vonage tests are correctly skipping since the VONAGE_* secrets aren't configured in CI yet. |
What does this PR do?
Adds a new SMS adapter for the Vonage Messages API (v1). This adapter is preferred over the legacy SMS API as it is more cost-effective and built on Vonage's modern messaging infrastructure.
Key details of the implementation:
Basicauthentication (Base64 encoded API Key and Secret) for the Messages API, matching Vonage's requirements for this endpoint.202 Acceptedstatus code, which is the exclusive success response for the Messages API.VonageMessagesBasetrait containing the common API logic, allowing future channel adapters (like WhatsApp or Viber) to easily reuse it.Test Plan
vendor/bin/phpstan analyse --level=6 src tests.tests/Messaging/Adapter/SMS/VonageMessagesTest.php, adhering to the repository's convention of environment-gated integration testing using theassertResponse()request-catcher.Authorizationheader generation, JSON payload composition, and fallbacks to guarantee the adapter correctly structures API requests.Related PRs and Issues
Closes #82
Have you read the Contributing Guidelines on issues?
Yes.