Skip to content

feat: Add Telnyx Adapter Improvements (#7811)#6

Open
deepshekhardas wants to merge 1 commit into
mainfrom
feat/7811-telnyx-adapter
Open

feat: Add Telnyx Adapter Improvements (#7811)#6
deepshekhardas wants to merge 1 commit into
mainfrom
feat/7811-telnyx-adapter

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented Apr 11, 2026

This PR adds improvements to the Telnyx adapter.

Changes:

  • Enhanced Telnyx API integration
  • Additional features support
  • Better error handling

Summary by cubic

Improves the Telnyx SMS adapter with per-recipient sending, a required from value, and clearer error messages. Aligns with Linear #7811.

  • New Features

    • Sends one API request per recipient and tracks delivery per recipient.
    • Requires and always uses from (Telnyx phone number or profile ID).
    • Returns Telnyx error details from errors[0].detail when available.
  • Migration

    • Update instantiation to: Telnyx($apiKey, $from).
    • Set env vars for tests/CI: TELNYX_API_KEY, TELNYX_FROM, TELNYX_TO.

Written for commit e416217. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 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/SMS/Telnyx.php">

<violation number="1" location="src/Utopia/Messaging/Adapter/SMS/Telnyx.php:19">
P1: Making `$from` mandatory here is a breaking change: existing callers can no longer pass the sender on `SMSMessage`, and the current Telnyx test now instantiates this adapter with too few arguments.</violation>
</file>

<file name="tests/Messaging/Adapter/SMS/TelnyxTest.php">

<violation number="1" location="tests/Messaging/Adapter/SMS/TelnyxTest.php:16">
P1: Pass the Telnyx `from` value to the constructor; this test currently calls it with too few arguments and will fail immediately.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

public function __construct(
private string $apiKey,
private ?string $from = null
private string $from,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Making $from mandatory here is a breaking change: existing callers can no longer pass the sender on SMSMessage, and the current Telnyx test now instantiates this adapter with too few arguments.

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/Telnyx.php, line 19:

<comment>Making `$from` mandatory here is a breaking change: existing callers can no longer pass the sender on `SMSMessage`, and the current Telnyx test now instantiates this adapter with too few arguments.</comment>

<file context>
@@ -11,55 +11,58 @@ class Telnyx extends SMSAdapter
     public function __construct(
         private string $apiKey,
-        private ?string $from = null
+        private string $from,
     ) {
     }
</file context>
Fix with Cubic

public function testSendSMS(): void
{
// $sender = new Telnyx(\getenv('TELNYX_API_KEY'));
$sender = new Telnyx(\getenv('TELNYX_API_KEY'));
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Pass the Telnyx from value to the constructor; this test currently calls it with too few arguments and will fail immediately.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/Messaging/Adapter/SMS/TelnyxTest.php, line 16:

<comment>Pass the Telnyx `from` value to the constructor; this test currently calls it with too few arguments and will fail immediately.</comment>

<file context>
@@ -11,18 +13,16 @@ class TelnyxTest extends Base
     public function testSendSMS(): void
     {
-        // $sender = new Telnyx(\getenv('TELNYX_API_KEY'));
+        $sender = new Telnyx(\getenv('TELNYX_API_KEY'));
 
-        // $message = new SMS(
</file context>
Suggested change
$sender = new Telnyx(\getenv('TELNYX_API_KEY'));
$sender = new Telnyx(\getenv('TELNYX_API_KEY'), \getenv('TELNYX_FROM'));
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant