LaravelPackages.net
Acme Inc.
Toggle sidebar
shiroamada/waha-laravel-notification

WAHA Notifications channel for Laravel 11 and Above

183
1
v11.0.0
About shiroamada/waha-laravel-notification

shiroamada/waha-laravel-notification is a Laravel package for waha notifications channel for laravel 11 and above. It currently has 1 GitHub stars and 183 downloads on Packagist (latest version v11.0.0). Install it with composer require shiroamada/waha-laravel-notification. Discover more Laravel packages by shiroamada or browse all Laravel packages to compare alternatives.

Last updated

WAHA notifications channel for Laravel 11+

Latest Version on Packagist Software License Build Status StyleCI Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using https://waha.devlike.pro/ with Laravel 11+.

Code Reference from laravel-notification-channels/smsc-ru

Contents

Installation

You can install the package via composer:

composer require shiroamada/waha-laravel-notification

Then you must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\Waha\WahaServiceProvider::class,
],

Setting up the WAHA service

Add your waha instanceId and token to your config/services.php:

// config/services.php
...
'waha' => [
    'apiUrl' => env('WAHA_API_URL'),
    'sessionId' => env('WAHA_SESSION_ID'),
    'token' => env('WAHA_TOKEN'),
    'isMalaysiaMode' => env('WAHA_MALAYSIA_MODE') ?? 0,
    'isEnable' => env('WAHA_ENABLE') ?? 0,
    'isDebug' => env('WAHA_DEBUG_ENABLE') ?? 0,
    'debugReceiveNumber' => env('WAHA_DEBUG_RECEIVE_NUMBER'),
],
...

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\Waha\WahaMessage;
use NotificationChannels\Waha\WahaChannel;

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

    public function toWaha($notifiable)
    {
        return WahaMessage::create("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForWaha() method, which return the phone number.

public function routeNotificationForWaha()
{
    return $this->mobile; //depend what is your db field
}

Available methods

content(): Set a content of the notification message.

sendAt(): Set a time for scheduling the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The Apache License Version 2.0. Please see License File for more information.

Star History Chart