PHP code example of grupodkt / notification-channel-waba

1. Go to this page and download the library: Download grupodkt/notification-channel-waba 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/ */

    

grupodkt / notification-channel-waba example snippets


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

// config/services.php
...
'waba' => [
    'url'   => env('WABA_URL'),
    'token' => env('WABA_TOKEN'),
    'phoneNumberId' => env('WABA_PHONE_NUMBER_ID'),
],
...

public function routeNotificationForWaba()
{
    return $this->mobile;
}
 php
use NotificationChannels\Waba\WabaChannel;
use NotificationChannels\Waba\WabaMessage;
use Illuminate\Notifications\Notification;

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

    public function toWaba($notifiable)
    {
        return (new WabaMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}