GibbonEdu / core

Gibbon is a flexible, open source school management platform designed to make life better for teachers, students, parents and leaders.
https://gibbonedu.org
GNU General Public License v3.0
452 stars 293 forks source link

Bug: Nexmo SMS no longer works #1680

Open fvlasie opened 1 year ago

fvlasie commented 1 year ago

Describe the Bug

Nexmo has been aqcuired by Vonage and the old code no longer works.

To Reproduce

Try to send a test SMS with Nexmo credentials.

Expected behavior

SMS should be sent.

Actual behavior

SMS is not sent.

Screenshots

No response

Gibbon version

v25

Browser

No response

Browser Version

No response

Additional Context

According to the Vonage API guide:

composer require vonage/client 
$basic  = new \Vonage\Client\Credentials\Basic("457ef234", "SHqUvS3ujQ21wwAAT");
$client = new \Vonage\Client($basic);
$response = $client->sms()->send(
    new \Vonage\SMS\Message\SMS("15413261278", BRAND_NAME, 'A text message sent using the Nexmo SMS API')
);

$message = $response->current();

if ($message->getStatus() == 0) {
    echo "The message was sent successfully\n";
} else {
    echo "The message failed with status: " . $message->getStatus() . "\n";
}

Where "457ef234" and "SHqUvS3ujQ21wwAAT" are the API key and API secret respectively. And "15413261278" is the receving number.

yookoala commented 1 year ago

Gibbon is using heavily matthewbdaly/sms-client for SMS sending. The best way to replace this, I think, is to write a Mattewbdaly's Driver implementation for Vonage API to replace it.

The example curl code can be found here or here:

curl -X "POST" "https://rest.nexmo.com/sms/json" \
  -d "from=$VONAGE_BRAND_NAME" \
  -d "text=A text message sent using the Vonage SMS API" \
  -d "to=$TO_NUMBER" \
  -d "api_key=$VONAGE_API_KEY" \
  -d "api_secret=$VONAGE_API_SECRET"

A slight modification of the Nexmo driver should do the job.

yookoala commented 1 year ago

@fvlasie: I roughly went over the API documentation. It seems there isn't any breaking change to the API. I don't quite understand why the current code would stop working. I tried to invoke the API directly with CURL and your API key and secret. But I got no SMS either. If their documentation is correct, perhaps the problem is elsewhere.

Could there be any issue with your Nexmo / Vonage account? Have you tried contacting their support service (https://www.vonage.com/support/) and ask about it?