Opscale\NotificationCenter\Notifications\SlackNotificationChannel identifier:
slackUnderlying driver:
Illuminate\Notifications\Slack\SlackChannel
SlackNotification posts a structured Block Kit message to a Slack channel using Laravel’s built-in Slack notification channel.
Method signatures
via()
Returns [SlackChannel::class], routing the notification through Illuminate\Notifications\Slack\SlackChannel.
toSlack(object $notifiable): SlackMessage
Builds and returns a Illuminate\Notifications\Slack\SlackMessage composed of three Block Kit blocks:
| Block | Content |
|---|---|
| Header block | $delivery->notification->subject |
| Section block | $delivery->notification->summary if set, otherwise $delivery->notification->subject |
| Actions block | A “View” button linking to the tracked open URL |
text field (used as the notification fallback in clients that do not render blocks) is also set to $delivery->notification->subject.
What data it sends
The Slack message contains:- A fallback
textequal to the notificationsubject - A header block with the notification
subject - A section block with the notification
summary(falls back tosubjectifsummaryis absent) - An actions block with a “View” button whose URL is the delivery’s tracked open URL
Usage example
Addslack to a strategy’s channels array:
routeNotificationForSlack() returning either a Slack channel name or an incoming webhook URL:
Laravel’s Slack channel requires the
laravel/slack-notification-channel Composer package (included in Laravel 10+ applications). Ensure a valid Slack bot token or incoming webhook URL is configured.