Search by

bahricanli / message-manager-client

Laravel client + notification channel for sending WhatsApp template messages through Message Manager (message-manager.tr)

Maintainers

Package info

github.com/bahricanli/message-manager-client

pkg:composer/bahricanli/message-manager-client

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-09-06 17:59 UTC

This package is not auto-updated.

Last update: 2026-09-07 16:24:20 UTC


README

License: MIT

Send WhatsApp template messages through Message Manager — a multi-tenant panel on top of the official WhatsApp Business Platform (Meta Cloud API).

Replaces the unofficial bahricanli/whatsapp-bridge (Baileys) with the official channel. Outbound is template-only; replies land in the Message Manager inbox, not back in your app.

Requirements

  • PHP 7.4+
  • Laravel 5.5+
  • A tenant on Message Manager with a connected WhatsApp number and at least one approved template.

Installation

composer require bahricanli/message-manager-client

Publish the config:

php artisan vendor:publish --tag=message-manager-config

Configuration

MESSAGE_MANAGER_URL=https://message-manager.tr
MESSAGE_MANAGER_KEY=mm_xxxxxxxx.your-secret     # Panel → Settings → API Keys
MESSAGE_MANAGER_FROM=                           # optional; only if tenant has >1 number
MESSAGE_MANAGER_DEFAULT_LANG=tr
MESSAGE_MANAGER_TIMEOUT=10

The API key scopes every request to one tenant and its connected number(s).

Usage

1. Direct

use NotificationChannels\MessageManager\MessageManagerFacade as WhatsApp;
use NotificationChannels\MessageManager\WhatsAppMessage;

// Shorthand — approved template + ordered body params ({{1}}, {{2}} ...)
WhatsApp::sendTemplate('905551112233', 'duyuru', ['Ahmet', '4821']);

// Fluent
WhatsApp::send(
    WhatsAppMessage::create('duyuru')
        ->to('05551112233')
        ->language('tr')
        ->parameters(['Ahmet', '4821'])
);

Response:

[
    'id'              => 42,          // Message Manager message id — use for status polling
    'conversation_id' => 7,
    'wa_message_id'   => 'wamid.HBg…',
    'status'          => 'sent',      // queued | sent | delivered | read | failed
    'type'            => 'template',
]

2. As a Laravel notification channel

use Illuminate\Notifications\Notification;
use NotificationChannels\MessageManager\WhatsAppChannel;
use NotificationChannels\MessageManager\WhatsAppMessage;

class PhoneVerificationNotification extends Notification
{
    public function __construct(private string $code) {}

    public function via($notifiable): array
    {
        return [WhatsAppChannel::class];
    }

    public function toMessageManager($notifiable): WhatsAppMessage
    {
        return WhatsAppMessage::create('dogrulama_kodu')
            ->parameters([$notifiable->name, $this->code]);
        // Recipient comes from routeNotificationForMessageManager()
    }
}

On the notifiable model:

public function routeNotificationForMessageManager(): string
{
    return $this->phone_number; // 905551112233
}

3. Parallel with NetGSM (SMS + WhatsApp)

public function via($notifiable): array
{
    return [
        \NotificationChannels\Netgsm\NetgsmChannel::class,
        \NotificationChannels\MessageManager\WhatsAppChannel::class,
    ];
}

public function toNetgsm($notifiable): string
{
    return "Doğrulama kodunuz: {$this->code}";
}

public function toMessageManager($notifiable): WhatsAppMessage
{
    return WhatsAppMessage::create('dogrulama_kodu')->parameters([$this->code]);
}

Channel failures (API down, timeout, rejected template) are logged and swallowed — they never break the primary flow.

Templates

WhatsApp::templates();          // approved only (default)
WhatsApp::templates(null);      // all statuses
[
    'data' => [
        ['name' => 'duyuru', 'language' => 'tr', 'category' => 'UTILITY',
         'status' => 'APPROVED', 'body_params' => 2],
    ],
]

body_params is how many ordered parameters the template body expects.

Templates are created and approved in the panel (Şablonlar), not through this client.

Delivery status

Meta reports delivery asynchronously. Poll:

$res = WhatsApp::sendTemplate('905551112233', 'duyuru', ['Ahmet', '4821']);

// later
$status = WhatsApp::status($res['id']);
// ['id' => 42, 'status' => 'delivered', 'delivered_at' => '...', 'read_at' => null, ...]

Health check

WhatsApp::ping(); // ['ok' => true, 'ts' => '2026-09-06T12:00:00+00:00']

Phone number formats

Normalized automatically: +90 555 123 45 67, 05551234567, 5551234567, 00905551234567905551234567.

Events

Event Fired
NotificationChannels\MessageManager\Events\SendingMessage before send
NotificationChannels\MessageManager\Events\MessageWasSent after the API accepts it

Migrating from bahricanli/whatsapp-bridge

whatsapp-bridge message-manager-client
WhatsApp::sendMessage($to, $text) WhatsApp::sendTemplate($to, $name, $params)
free text, any time approved template only
toWhatsApp() on notification toMessageManager()
routeNotificationForWhatsAppBridge() routeNotificationForMessageManager()
replies: your bridge / webhook replies: Message Manager inbox
WHATSAPP_BRIDGE_URL / _API_KEY MESSAGE_MANAGER_URL / _KEY

License

MIT — see LICENSE.md.