guysolamour/laravel-callmebot

一个用于通过callmebot api发送消息的包

v2.1 2023-06-13 17:53 UTC

This package is auto-updated.

Last update: 2024-09-13 20:38:49 UTC


README

Packagist Packagist Packagist

安装

通过composer安装

composer require guysolamour/laravel-callmebot

用法

WhatsApp

发送消息

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

// or

Guysolamour\Callmebot\Facades\Whatsapp::send([
  'apikey'   => $apikey,
  'phone'    => $phone,
  'text'     => $message,
]);

发送通知

// 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);
}

安全

如果您发现任何与安全相关的问题,请通过电子邮件rolandassale@gmail.com联系,而不是使用问题跟踪器。

感谢

此包是由melihovv/laravel-package-generator的帮助启动的。