This package makes it easy to send KudiSMS notifications with Laravel 8.x, 9.x & 10.x
You can install the package via composer:
composer require toneflix-code/kudisms-notification
Add your KudiSMS Account token, SenderId, and CallerId (optional) to your .env
:
KUDISMS_GATEWAY= # optional
KUDISMS_API_KEY=ZYX # always required
KUDISMS_SENDER_ID=ABCD # always required
KUDISMS_CALLER_ID=ABCD # optional when sender id is set
KUDISMS_TEST_NUMBERS=23423423423,12312312312 # Comma separated list of numbers to send messages to when running tests
Run php artisan vendor:publish --provider="ToneflixCode\KudiSmsNotification\KudiSmsProvider"
/config/kudi-notification.php
Now you can use the channel in your via()
method inside the notification:
use ToneflixCode\KudiSmsNotification\KudiSmsChannel;
use ToneflixCode\KudiSmsNotification\KudiSmsMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [KudiSmsChannel::class];
}
public function toKudiSms($notifiable)
{
return (new KudiSmsMessage())
->message("Your {$notifiable->service} account was approved!");
}
}
You can also create a Kudi voice call:
use ToneflixCode\KudiSmsNotification\KudiSmsChannel;
use ToneflixCode\KudiSmsNotification\KudiSmsVoiceMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [KudiSmsChannel::class];
}
public function toTwilio($notifiable)
{
return (new KudiSmsVoiceMessage())
->url("https://download.samplelib.com/mp3/sample-3s.mp3");
}
}
Or create a Kudi Text To Speach call:
use ToneflixCode\KudiSmsNotification\KudiSmsChannel;
use ToneflixCode\KudiSmsNotification\KudiSmsTTSMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [KudiSmsChannel::class];
}
public function toTwilio($notifiable)
{
return (new KudiSmsTTSMessage())
->message("Hello {$notifiable->name}, how are you today?");
}
}
In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number
attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForKudiSms
method to your Notifiable model.
public function routeNotificationForKudiSms()
{
return '+2349034567890';
}
senderId('')
: Accepts a registered SenderId to use as the notification sender.message('')
: Accepts a string value for the notification body.
callerId('')
: Accepts a registered CallerId to use as the notification sender.url('')
: Accepts a url of a publicly available audio file.
callerId('')
: Accepts a registered CallerId to use as the notification sender.message('')
: Accepts a string value for the notification body.
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.