feat: Add Vonage Messages Adapter (#8139)#7
Open
deepshekhardas wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
2 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/Utopia/Messaging/Adapter/VonageTrait.php">
<violation number="1" location="src/Utopia/Messaging/Adapter/VonageTrait.php:30">
P2: Guard against empty recipient lists before reading `$message->getTo()[0]`; otherwise this path triggers undefined index warnings and builds invalid requests.</violation>
</file>
<file name="src/Utopia/Messaging/Adapter/SMS/VonageMessages.php">
<violation number="1" location="src/Utopia/Messaging/Adapter/SMS/VonageMessages.php:12">
P1: `VonageTrait` is referenced from the wrong namespace. This class needs to import or fully qualify `Utopia\Messaging\Adapter\VonageTrait`, otherwise it will fail to load.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| class VonageMessages extends SMSAdapter | ||
| { | ||
| use VonageTrait; |
There was a problem hiding this comment.
P1: VonageTrait is referenced from the wrong namespace. This class needs to import or fully qualify Utopia\Messaging\Adapter\VonageTrait, otherwise it will fail to load.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/Utopia/Messaging/Adapter/SMS/VonageMessages.php, line 12:
<comment>`VonageTrait` is referenced from the wrong namespace. This class needs to import or fully qualify `Utopia\Messaging\Adapter\VonageTrait`, otherwise it will fail to load.</comment>
<file context>
@@ -0,0 +1,34 @@
+
+class VonageMessages extends SMSAdapter
+{
+ use VonageTrait;
+
+ protected const NAME = 'VonageMessages';
</file context>
Suggested change
| use VonageTrait; | |
| use \Utopia\Messaging\Adapter\VonageTrait; |
| { | ||
| $payload = [ | ||
| 'from' => $this->from ?? $message->getFrom(), | ||
| 'to' => \ltrim($message->getTo()[0], '+'), |
There was a problem hiding this comment.
P2: Guard against empty recipient lists before reading $message->getTo()[0]; otherwise this path triggers undefined index warnings and builds invalid requests.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/Utopia/Messaging/Adapter/VonageTrait.php, line 30:
<comment>Guard against empty recipient lists before reading `$message->getTo()[0]`; otherwise this path triggers undefined index warnings and builds invalid requests.</comment>
<file context>
@@ -0,0 +1,72 @@
+ {
+ $payload = [
+ 'from' => $this->from ?? $message->getFrom(),
+ 'to' => \ltrim($message->getTo()[0], '+'),
+ 'message_type' => 'text',
+ 'text' => $message->getContent(),
</file context>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds support for Vonage Messages API adapter.
Changes:
Summary by cubic
Add a Vonage Messages adapter with SMS, WhatsApp, Viber, and MMS support. Uses a shared trait with JWT auth and follows the existing adapter pattern.
New Features
WhatsApp,Viber,MMS.SMS\VonageMessages,WhatsApp\Vonage,Viber\Vonage,MMS\Vonage.VonageTraitto build payloads, sign JWTs (RS256), and POST to https://api.nexmo.com/v1/messages.message_uuid, otherwise includes error).Migration
fromis supported.Written for commit ba22934. Summary will update on new commits.