PHP code example of shiroamada / waha-laravel-notification

1. Go to this page and download the library: Download shiroamada/waha-laravel-notification library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shiroamada / waha-laravel-notification example snippets


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

// 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'),
],
...

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!");
    }
}

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