From a51da57b360ae86564e3501de9dfd41f6aaf8bbd Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 23 Jun 2026 11:11:18 +0530 Subject: [PATCH] feat(messaging): attach project ID to internal SMS for provider attribution (#12653) * feat(messaging): attach project ID to internal SMS for provider attribution Internal (auth) SMS such as phone OTP, MFA challenges and team invites are sent through Appwrite's own provider, but the provider's delivery logs and webhooks carry no way to trace a message back to the project that triggered it. Attach the project ID as the MSG91 UUID tracking field (supported via utopia-php/messaging 1.2.0) so provider-side reports can be reconciled per project. Bumps utopia-php/messaging 1.1.0 -> 1.2.0. * chore(messaging): require utopia-php/messaging ^1.2 The internal SMS path now depends on SMS::setMetadata() and the Msg91\MetadataParameter enum, both introduced in 1.2.0, so raise the constraint from ^1.1 to ^1.2 to enforce the minimum at install time. --- composer.json | 2 +- composer.lock | 14 +++++++------- src/Appwrite/Platform/Workers/Messaging.php | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 21432398af..2a1499f1a8 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", - "utopia-php/messaging": "^1.1", + "utopia-php/messaging": "^1.2", "utopia-php/migration": "1.14.*", "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", diff --git a/composer.lock b/composer.lock index d3bee71eb6..652b26e041 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c365042d311895a9cddaceca7623b1e", + "content-hash": "508b3e633843d61eb24f864fd8832db0", "packages": [ { "name": "adhocore/jwt", @@ -4348,16 +4348,16 @@ }, { "name": "utopia-php/messaging", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "2a8e82cda89b373833e10923ae959f56466300a3" + "reference": "3419ffbbeb242b3232b588430bd465024959720c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/2a8e82cda89b373833e10923ae959f56466300a3", - "reference": "2a8e82cda89b373833e10923ae959f56466300a3", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/3419ffbbeb242b3232b588430bd465024959720c", + "reference": "3419ffbbeb242b3232b588430bd465024959720c", "shasum": "" }, "require": { @@ -4394,9 +4394,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/1.1.0" + "source": "https://github.com/utopia-php/messaging/tree/1.2.0" }, - "time": "2026-06-16T03:44:58+00:00" + "time": "2026-06-23T04:24:43+00:00" }, { "name": "utopia-php/migration", diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 2a827f82cb..92745a0f91 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -33,6 +33,7 @@ use Utopia\Messaging\Adapter\SMS\GEOSMS; use Utopia\Messaging\Adapter\SMS\Inforu; use Utopia\Messaging\Adapter\SMS\Mock; use Utopia\Messaging\Adapter\SMS\Msg91; +use Utopia\Messaging\Adapter\SMS\Msg91\MetadataParameter; use Utopia\Messaging\Adapter\SMS\Telesign; use Utopia\Messaging\Adapter\SMS\TextMagic; use Utopia\Messaging\Adapter\SMS\Twilio; @@ -824,6 +825,10 @@ class Messaging extends Action ); $sms->setOrigin(MESSAGE_SEND_TYPE_INTERNAL); + // Attach the project ID so the SMS provider's delivery logs and + // webhooks can be attributed back to the originating project. + $sms->setMetadata([MetadataParameter::UUID->value => $project->getId()]); + $this->adapter->send($sms); }