Laravel Rocket Chat Notifications


April 19th, 2022

Laravel Rocket Chat Notifications

Laravel Rocket Chat Notifications is a package that makes it easy to send notifications using RocketChat with Laravel 9+:

use Illuminate\Notifications\Notification;
use TeamNiftyGmbh\RocketChatNotifications\Channels\RocketChatNotificationChannel;
use TeamNiftyGmbh\RocketChatNotifications\Messages\RocketChatMessage;
class TaskCompleted extends Notification
public function via(mixed $notifiable): array
return [
public function toRocketChat($notifiable): RocketChatMessage
return RocketChatMessage::create('Test Message');

The RocketChatMessage class has convenient methods to formulate your RocketChat messages. Here's an example of a few of them, including adding an attachment:

public function toRocketChat($notifiable)
return RocketChatMessage::create('Test message')
// optional if set in config
// optional if set in config
->from('access_token', 'rocket_chat_user_id')
'image_url' => 'test'
new RocketChatAttachment(['image_url' => 'test']),
// Or via array
'image_url' => 'test'

For a complete list of everything, you can do to format a message, check out the available methods in the readme.

Rocket.Chat is a communication platform with private chats, team chats, etc. and includes pricing options for the SaaS product and self-managed installations. You can learn more about this package, get full installation instructions, and view the source code on GitHub.

This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.