Member-only story
Send Slack Notifications with Laravel 8
3 min readApr 9, 2021
We will learn to send Slack notifications with Laravel 8
Step 1. Install Slack notification channel
Before you can send notifications via Slack, you must install the Slack notification channel via Composer:
composer require laravel/slack-notification-channel
Step 2. Create and configure Notification
In Laravel, each notification is represented by a single class that is typically stored in the app/Notifications
directory. Don't worry if you don't see this directory in your application - it will be created for you when you run the make:notification
Artisan command:
php artisan make:notification SendNotification
Next configure file app/Notification/SendNotification
<?php
namespace App\Notifications;use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\SlackMessage;class SendNotification extends Notification
{
use Queueable;
private $user; public function __construct($user)
{
$this->user = $user;
}