Skip to main content
The slack and teams channels are ideal for system and alert notifications that need to surface in team communication tools rather than to individual end-users. Both channels post messages to configured webhooks.

When to use Slack/Teams vs. user-facing channels

Slack / Teams

Best for internal team alerts, system health notifications, and ops-level messages. Target a shared Slack channel or Teams channel where the whole team is notified.

nova / card / webpush

Best for end-user notifications inside your product. Each user receives their own targeted message.

Slack

Installation

The slack channel uses Laravel’s first-party laravel/slack-notification-channel package:
composer require laravel/slack-notification-channel

Configuring the webhook URL

Add your Slack incoming webhook URL to your notifiable model by implementing routeNotificationForSlack():
public function routeNotificationForSlack(): string
{
    return env('SLACK_WEBHOOK_URL');
}
Or store it directly on the user/profile model and return it from the route method.

The SlackNotification class

// src/Notifications/SlackNotification.php
public function via(object $notifiable): array
{
    return [SlackChannel::class];
}

public function toSlack(object $notifiable): SlackMessage
{
    $model = $this->delivery->notification;

    $message = (new SlackMessage)
        ->text($model->subject)
        ->headerBlock($model->subject)
        ->sectionBlock(function (SectionBlock $block) use ($model) {
            $block->text($model->summary ?? $model->subject);
        });

    $url = route('notification-center.track.open', $this->delivery->open_slug);

    $message->actionsBlock(function (ActionsBlock $block) use ($url) {
        $block->button(__('View'))->url($url);
    });

    return $message;
}
The Slack message uses Block Kit:
  • A header block with the notification subject.
  • A section block showing the summary (falls back to subject if summary is empty).
  • An actions block with a View button linking to the tracking URL.

Registering the slack channel

// config/notification-center.php
'messages' => [
    'slack' => \Opscale\NotificationCenter\Notifications\SlackNotification::class,
    // ...
],
Then add slack to a strategy:
'system' => [
    'channels' => ['slack'],
    // ...
],

Microsoft Teams

Installation

The teams channel uses the laravel-notification-channels/microsoft-teams package:
composer require laravel-notification-channels/microsoft-teams

Configuring the webhook URL

Implement routeNotificationForMicrosoftTeams() on your notifiable model:
public function routeNotificationForMicrosoftTeams(): string
{
    return env('TEAMS_WEBHOOK_URL');
}

The TeamsNotification class

// src/Notifications/TeamsNotification.php
public function via(object $notifiable): array
{
    return [MicrosoftTeamsChannel::class];
}

public function toMicrosoftTeams(object $notifiable): MicrosoftTeamsAdaptiveCard
{
    $model = $this->delivery->notification;

    $card = MicrosoftTeamsAdaptiveCard::create()
        ->title($model->subject)
        ->content([
            TextBlock::create()
                ->setText($model->summary ?? $model->subject)
                ->setIsSubtle(true),
        ]);

    $url = route('notification-center.track.open', $this->delivery->open_slug);

    $card->actions([
        ActionOpenUrl::create()
            ->setTitle(__('View'))
            ->setUrl($url),
    ]);

    return $card;
}
The Teams message uses an Adaptive Card:
  • A title set to the notification subject.
  • A TextBlock with the summary (falls back to subject).
  • An ActionOpenUrl button linking to the tracking URL.

Registering the teams channel

// config/notification-center.php
'messages' => [
    'teams' => \Opscale\NotificationCenter\Notifications\TeamsNotification::class,
    // ...
],
Then add teams to a strategy:
'alert' => [
    'channels' => ['teams'],
    // ...
],

Comparing Slack and Teams

  • Package: laravel/slack-notification-channel
  • Message format: Block Kit (header + section + actions)
  • Routing method: routeNotificationForSlack()
  • Channel identifier: slack
Both channels include a View button that routes through the package’s tracking URL (notification-center.track.open), so opens are recorded even for Slack and Teams messages.

Build docs developers (and LLMs) love