New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spatie/interactive-slack-notification-channel

Send interactive Slack notifications in Laravel apps
90,047 66
Install
composer require spatie/interactive-slack-notification-channel
Latest Version:1.4.0
PHP:^8.3
Laravel:12 · 13
Older releases:8 – 11
License:MIT
Last Updated:Oct 22, 2026
Links: GitHub  ·  Packagist
Maintainer: spatie

Send interactive Slack notifications in Laravel apps

Latest Version on Packagist Tests Total Downloads

This package allows you to send interactive Slack notifications. Here's how such a notification could look like

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/interactive-slack-notification-channel

Usage

In your Notifiable classes you should add a method named routeNotificationForInteractiveSlack that returns an array with the API token, an optionally the channel name

public function routeNotificationForInteractiveSlack()
{
    return [
        'token' => 'xoxp-slack-token',
        'channel' => '#general' // this is optional
    ];
}

Replying to message threads

Let's assume you want your application to send a Slack notification when an order gets placed. You also want any subsequent messages about the order be place in the same thread.

Using the SlackApi channels you can retrieve the API response from Slack's chat.postMessage method. With this response you could post messages on other events that happen on the order, such as order paid, shipped, closed, etc.

Here's an example:

use Spatie\InteractiveSlackNotificationChannel\Messages\SlackMessage

public function toInteractiveSlack($notifiable)
{
    return (new SlackMessage)->content('A new order has been placed');
}

public function interactiveSlackResponse(array $response)
{    
    $this->order->update(['slack_thread_ts' => $response['ts']]);
}

In your order paid event you can have

use Spatie\InteractiveSlackNotificationChannel\Messages\SlackMessage;
use Spatie\InteractiveSlackNotificationChannel\Messages\SlackAttachment;

public function toInteractiveSlack($notifiable)
{
    $order = $this->order;

    return (new SlackMessage)
        ->success()
        ->content('Order paid')
        ->threadTimestamp($order->slack_thread_ts)
        ->attachment(function(SlackAttachment $attachment) use ($order) {
           $attachment
                ->title("Order $order->reference has been paid for.")
                ->content('Should now be processed.')
                ->action('View Order', route('orders', $order->reference));
       });
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Some parts of the code and readme are based on this package.

License

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

Related Packages

cldt/interactive-slack-notification-channel

Send interactive Slack notifications in Laravel apps

1,834 0
spatie/elasticsearch-search-string-parser

Build Elasticsearch queries based of a query string

24,278 51
spatie/backtrace

A better backtrace

208,709,058 437
spatie/laravel-package-tools

Tools for creating Laravel packages

185,188,882 951
spatie/image-optimizer

Easily optimize images using PHP

93,761,798 2,882

Version History

Version Released PHP Laravel License
1.4.0 ^8.3 ^12.0|^13.0 MIT
1.3.0 ^8.2 ^11.0|^12.0 MIT
1.2.0 ^8.0 ^8.0|^9.0|^10.0|^11.0 MIT
1.1.2 ^8.0 ^8.0|^9.0|^10.0 MIT
1.1.1 ^8.0 ^8.0|^9.0 MIT