PHP code example of mohdradzee / laravel-wati-notification
1. Go to this page and download the library: Download mohdradzee/laravel-wati-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/ */
mohdradzee / laravel-wati-notification example snippets
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use mohdradzee\WatiNotification\WatiMessage;
class ConfirmWhatsappNumber extends Notification
{
use Queueable;
public function via($notifiable)
{
return ['wati'];
}
public function toWati($notifiable)
{
return WatiMessage::create()
->to($notifiable->phone)
->withAction('add_contact')
->withMeta([
'fullName' => $notifiable->name,
'customParams' => [
'source' => 'signup_page',
],
]);
}
}
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
// Ensure `phone` attribute exists
}
use mohdradzee\WatiNotification\Contracts\WatiApiStrategy;
class MyCustomStrategy implements WatiApiStrategy
{
public function execute(array $data): array
{
// call your custom WATI endpoint...
}
}