feat: add Vonage Messages API adapter#127
Conversation
Greptile SummaryThis PR renames the existing
Confidence Score: 4/5Both adapters will throw a fatal uninitialized typed-property error on every send() call — needs fixes before merge. The removal of parent::__construct() from VonageLegacy is a regression, and VonageMessages was never given the call. Both adapters will throw a fatal error the moment send() is invoked. The issues are isolated to two files and the fix is mechanical, but the adapters are fully broken as-is. src/Utopia/Messaging/Adapter/SMS/VonageLegacy.php and src/Utopia/Messaging/Adapter/SMS/VonageMessages.php both need parent::__construct() restored/added. Important Files Changed
Reviews (3): Last reviewed commit: "chore: remove old Vonage files after ren..." | Re-trigger Greptile |
| use Utopia\Messaging\Response; | ||
|
|
||
| class Vonage extends SMSAdapter | ||
| class VonageLegacy extends SMSAdapter |
There was a problem hiding this comment.
Breaking rename with no backward-compatibility alias
Renaming Vonage → VonageLegacy drops the original class name entirely. Any downstream code using new \Utopia\Messaging\Adapter\SMS\Vonage(...) or use Utopia\Messaging\Adapter\SMS\Vonage will throw a fatal Class not found error after upgrading this library. The PR description mentions a "backward compat note" but no alias or deprecation shim is present in the diff. Consider adding class_alias(VonageLegacy::class, 'Utopia\\Messaging\\Adapter\\SMS\\Vonage'); at the bottom of this file (or in a dedicated compat file), or coordinate a semver-major release.
| public function testSendSMS(): void | ||
| { | ||
| $this->markTestSkipped('Vonage Messages credentials are not available.'); | ||
|
|
||
| /* | ||
| $apiKey = \getenv('VONAGE_MESSAGES_API_KEY'); | ||
| $apiSecret = \getenv('VONAGE_MESSAGES_API_SECRET'); | ||
|
|
||
| $sender = new VonageMessages($apiKey, $apiSecret); | ||
|
|
||
| $message = new SMS( | ||
| to: [\getenv('VONAGE_MESSAGES_TO')], | ||
| content: 'Test Content', | ||
| from: \getenv('VONAGE_MESSAGES_FROM'), | ||
| ); | ||
|
|
||
| $response = $sender->send($message); | ||
|
|
||
| $this->assertNotEmpty($response['results']); | ||
| $this->assertNotEmpty($response['results'][0]['success']); | ||
| */ | ||
| } |
There was a problem hiding this comment.
The test immediately calls markTestSkipped and the real assertions are in a block comment rather than an if (! $creds) { markTestSkipped(); } guard pattern. Tests for other adapters (e.g., VonageLegacyTest) use live credentials gated by env vars. If VONAGE_MESSAGES_API_KEY etc. are simply not available in CI, the existing skip-unless-env-var pattern should be used here too, so the test actually executes when credentials are configured.
66ece4c to
c039ea6
Compare
Renames the existing Vonage adapter to VonageLegacy and adds a new VonageMessages adapter using the modern Vonage Messages API (V1). Based on PR utopia-php#111 by bhardwajparth51.
c039ea6 to
19c976f
Compare
|
Following up - this PR has been waiting for review. Happy to address any feedback or make changes. |
Port of PR #111 by bhardwajparth51.
Renames the existing Vonage adapter to VonageLegacy and adds a new VonageMessages adapter using the modern Vonage Messages API (V1) which is more cost-effective and versatile.
Changes: