guysolamour/laravel-callmebot

A package to send messages with callmebot api

v1.0.2 2021-10-17 11:30 UTC

This package is auto-updated.

Last update: 2021-12-17 11:48:18 UTC


README

Packagist Packagist Packagist

Installation

Install via composer

composer require guysolamour/laravel-callmebot

Usage

Whatsapp

Send message

Guysolamour\Callmebot\Clients\Whatsapp::apikey($apikey)->phone($phone)->message($message)->send();

// or

Guysolamour\Callmebot\Clients\Whatsapp::send([
  'apikey'   => $apikey,
  'phone'    => $phone,
  'message'  => $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.