guysolamour / laravel-callmebot
A package to send messages with callmebot api
v2.1
2023-06-13 17:53 UTC
Requires
- illuminate/support: ^10.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^10.0
README
Installation
Install via composer
composer require guysolamour/laravel-callmebot
Usage
Send message
Guysolamour\Callmebot\Facades\Whatsapp::apikey($apikey)->phone($phone)->message($message)->send(); // or Guysolamour\Callmebot\Facades\Whatsapp::send([ 'apikey' => $apikey, 'phone' => $phone, 'text' => $message, ]);
Send notification
// in Notification file /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['cbwhatsapp']; // or ['Guysolamour\Callmebot\Channels\WhatsappChannel::class'] } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toCbWhatsapp($notifiable) { return "Message ..."; } // in Notifiable model public function enableCallmebotNotification() :bool { return true; } public function routeNotificationForCbWHatsapp() { return 0102030405; } /** * Get callmebot api keys * * @param string|null $client * @return string|array */ public function callmebotApiKeys(?string $client = null) { $client_keys = [ 'whatsapp' => 012345, ]; if (is_null($client)){ return $client_keys; } return Arr::get($client_keys, $client); }
Security
If you discover any security related issues, please email rolandassale@gmail.com instead of using the issue tracker.
Credits
This package is bootstrapped with the help of melihovv/laravel-package-generator.