ClickSend Notifications channel for Laravel 8

1.1.0 2021-09-08 05:38 UTC

This package is auto-updated.

Last update: 2022-09-08 07:52:20 UTC


This package makes it easy to send notifications using messagemedia.com with Laravel 8.


Install the package via composer:

composer require ayles-software/laravel-sms-messagemedia

When generating an API key in Message Media make sure to use the Basic Authentication type. HMAC Auth is not supported

Add your MessageMedia api key, secret and optional default sender sms_from to your config/services.php:

'message_media' => [
    'key' => env('MESSAGE_MEDIA_KEY'),
    'secret'  => env('MESSAGE_MEDIA_SECRET'),
    'from' => env('MESSAGE_MEDIA_FROM'),


Use MessageMediaChannel in via() method inside your notification classes. Example:

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use AylesSoftware\MessageMedia\MessageMediaChannel;
use AylesSoftware\MessageMedia\MessageMediaMessage;

class SmsTest extends Notification
    public function __construct(public string $token)

    public function via($notifiable)
        return [MessageMediaChannel::class];

    public function toMessageMedia($notifiable)
        return (new MessageMediaMessage)
            ->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")
        // setting a delay when the sms should be sent
        return (new MessageMediaMessage)
            ->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")

In notifiable model (User), include method routeNotificationForMessageMedia() that returns recipient mobile number:

public function routeNotificationForMessageMedia()
    return $this->phone;

Then send a notification the standard way:

$user = User::find(1);

$user->notify(new SmsTest);


Following events are triggered by Notification. By default:

  • Illuminate\Notifications\Events\NotificationSending
  • Illuminate\Notifications\Events\NotificationSent

NotificationFailed will trigger if something goes wrong

  • Illuminate\Notifications\Events\NotificationFailed




The MIT License (MIT). Please see License File for more information.