Search by

hubmais / h-plugin-waha

Plugin Laravel to send notification to WhatsApp via Waha

Maintainers

Package info

github.com/hubmais-lab/h-plugin-waha

pkg:composer/hubmais/h-plugin-waha

Transparency log

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.2 2026-09-07 22:49 UTC

This package is not auto-updated.

Last update: 2026-09-08 01:56:37 UTC


README

Esse plugin foi construído com o objetivo de enviar mensagens via notificação por WhatsApp utlizando o serviço do Waha.

Aqui vamos mostrar como é facil a instalação e utilização.

Requisitos

Instalação

O plugin pode ser adicionado a seu projeto com o comando abaixo:

composer require hubmais/h-plugin-waha

Laravel

Esse plugin desenvolvido para ser usado em Laravel, a partir da versão 10. Após a instalação é necessário executar o comando abaixo:

php artisan vendor:publish --provider="Hubmais\HPluginWaha\Providers\HPluginWahaChannelServiceProvider"

Depois é necessário configurar o arquivo de configuração, presente em config/h-waha.php com as credenciais fornecidas.

Exemplos de uso

Crie uma notificação

php artisan make:notification InvoicePaid

Configure a Notificação

<?php

namespace App\Notifications;

use App\Models\Invoice;
use Hubmais\HPluginWaha\Messages\HPluginWahaMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     */
    public function __construct(
        protected Invoice $invoice,
    )
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['h-waha'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toHWaha(object $notifiable): MailMessage
    {
        return (new HPluginWahaMessage)
            ->content("Hello, payment for order {$this->invoice->id} has been confirmed! Thank you for your purchase!");
    }
}

Configure a Model de origem

<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the HPluginWaha channel.
     *
     * @return  array<string, string>|string
     */
    public function routeNotificationForHWaha(Notification $notification): array|string
    {
        return $this->phone_number.'@c.us';
    }
}

Disparando a notificação

<?php

...

$user->notify(new InvoicePaid($invoice));

...