kgoofori/widepay-sms-notification

This package makes it easy to send SMS notifications using Widepaycash SMS API the laravel way

v1.0.3 2021-07-29 11:42 UTC

This package is auto-updated.

Last update: 2024-09-22 11:51:27 UTC


README

This package makes it easy to send SMS notifications using Widepaycash SMS API the laravel way

Contents

Installation

Install this package with Composer:

composer require kgoofori/widepay-sms-notification

Setting up the FCM service

You need to register for a API id and key from Widepaycash for your application from here: https://widepaycash.com/

Once you've registered and generated ypu API id and key, add the API id and key to your configuration in config/broadcasting.php

'connections' => [
    ....
    'widepay_sms' => [
            'id' => env('WIDEPAY_ID', ''),
            'key' => env('WIDEPAY_KEY', ''),
        ]
    ...
]

Usage

You can now send SMS notifications via Widepay API by creating a WidepaySmsMessage:

...
use NotificationChannels\WidepaySms\WidepaySmsChannel;
use NotificationChannels\WidepaySms\WidepaySmsMessage;

class UserActivated extends Notification
{
    public function via($notifiable)
    {
        return [WidepaySmsChannel::class];
    }

    public function toWidepaySms($notifiable)
    {
        return (new WidepaySmsMessage)
            ->sender('WidepaySms')
            ->message('Testing message')
            ->recipient('23324XXXXXXX'); //optional if routeNotificationForWidepaySms() is set on notifiable model
    }
}

You may have to set a routeNotificationForWidepaySms() method in your notifiable model. For example:

class User extends Authenticatable
{
    use Notifiable;

    ....

    /**
     * Specifies the user's phone
     *
     * @return string
     */
    public function routeNotificationForWidepaySms()
    {
        return $this->phone;
    }
}

Once you have that in place, you can simply send a notification to the user via

$user->notify(new AccountActivated);

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email kgoofori@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.