This package makes it easy to send notifications using Ubicual with Laravel 7.x and 8.x
You can install the package via composer:
composer require kineticamobile/lubichannel
Add your Ubicual Product Token and default originator (name or number of sender) to your config/ubicual.php
:
// config/ubicual.php
...
return [
'api_token' => env('UBICUAL_API_TOKEN'),
'from' => env('UBICUAL_FROM', 'Ubicual'),
'base_url' => env('UBICUAL_BASE_URL', 'https://api.ubicual.com/api/v1/sms/send'),
];
...
You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification;
use Kineticamobile\Ubicual\UbicualMessage;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return ["ubicual"];
}
public function toUbicual($notifiable)
{
return (new UbicualMessage)->content("Your account was approved!");
}
}
In your notifiable model, make sure to include a routeNotificationForUbicual() method, which returns a phone number or an array of phone numbers.
public function routeNotificationForUbicual()
{
return $this->phone_number;
}
Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:
Notification::route('ubicual', '5555555555')
->notify(new InvoicePaid($invoice));
from('')
: Accepts a phone number/sender name to use as the notification sender.. Make sure to register the sender name at you Ubicual dashboard.
content('')
: 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.