PHPackages                             beyondcode/slack-notification-channel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. beyondcode/slack-notification-channel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

beyondcode/slack-notification-channel
=====================================

Slack Notification Channel for Laravel using API tokens.

1.10.0(2y ago)85529.6k↓46.1%15[1 issues](https://github.com/beyondcode/slack-notification-channel/issues)[1 PRs](https://github.com/beyondcode/slack-notification-channel/pulls)MITPHPPHP ^7.3.0|^8.0|^8.1CI failing

Since May 15Pushed 2y ago4 watchersCompare

[ Source](https://github.com/beyondcode/slack-notification-channel)[ Packagist](https://packagist.org/packages/beyondcode/slack-notification-channel)[ RSS](/packages/beyondcode-slack-notification-channel/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

Laravel Slack API Token Notification Channel
============================================

[](#laravel-slack-api-token-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9cd10e46a5330c5027c8f8db2734d8de7e00fab2d6c0f3113bdc423ed55485df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265796f6e64636f64652f736c61636b2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/slack-notification-channel)[![GitHub Workflow Status](https://camo.githubusercontent.com/94f870bc229e414de773c783e8a3cc07fd1ecfd8aa1557673fc881b1795e42e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6265796f6e64636f64652f736c61636b2d6e6f74696669636174696f6e2d6368616e6e656c2f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/94f870bc229e414de773c783e8a3cc07fd1ecfd8aa1557673fc881b1795e42e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6265796f6e64636f64652f736c61636b2d6e6f74696669636174696f6e2d6368616e6e656c2f72756e2d74657374733f6c6162656c3d7465737473)[![Quality Score](https://camo.githubusercontent.com/cf927c284863b4626e2066c7ae71edac149063e310651406655165c828df14c6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6265796f6e64636f64652f736c61636b2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/beyondcode/slack-notification-channel)[![Total Downloads](https://camo.githubusercontent.com/13ef521aece84530b29419b43c2c9206b9959f97213fc070a68b0d57a784450e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265796f6e64636f64652f736c61636b2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/slack-notification-channel)

This is the Laravel Slack notification channel, but instead of using incoming webhooks, this channel makes use of OAuth access tokens. It also allows replies to thread messages.

[![https://phppackagedevelopment.com](https://camo.githubusercontent.com/5dc18c4ff15fcc006449417087f3bffd562e2fc42d3729c95de9573d70cf2524/68747470733a2f2f6265796f6e64636f2e64652f636f75727365732f70687070642e6a7067)](https://phppackagedevelopment.com)

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.

### Usage

[](#usage)

Install the package via composer:

```
composer require beyondcode/slack-notification-channel

```

The service provider gets registered automatically and you can use this package as a replacement of the core Laravel Slack notification channel.

### Notification Routing

[](#notification-routing)

Since this notification channel makes use of Slack API tokens instead of incoming webhook URLs, you need to return an array containing the API token and an optional channel. This channel will be used, if it is not provided in the `SlackMessage` that you send:

```
public function routeNotificationForSlack()
{
    return [
        'token' => 'xoxp-slack-token',
        'channel' => '#general'
    ];
}
```

### Replying to Message Threads

[](#replying-to-message-threads)

Assuming you want to keep track of orders and have your team/bot respond to a single thread of per order placed, this channel allows you to retrieve the API response from the chat.postMessage method inside your notifications. With this you could post messages on order paid, shipped, closed, etc. events to the same thread.

In your order placed event you can have

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

public function response($response)
{
    $response = $response->getBody()->getContents();
    $this->order->data('slack.thread_ts', json_decode($response, true)['ts']);
}
```

And in your order paid event you can have

```
public function toSlack($notifiable)
{
    $order = $this->order;
    return (new SlackMessage)
        ->success()
        ->content('Order paid')
        ->threadTimestamp($order->data('slack.thread_ts'))
           ->attachment(function ($attachment) use ($order) {
               $attachment->title("Order $order->reference has been paid for.")
                          ->content('Should now be processed.')
                          ->action('View Order', route('orders', $order->reference));
           });
}
```

Customizing the channel name
----------------------------

[](#customizing-the-channel-name)

Laravel ships with a slack notification channel which uses web hooks. This packages overwrites that default slack channel.

Should you want to use Laravel's default Slack channel and this one inside one app, you'll need to use a different channel name.

You can set the channel name using

```
SlackApiChannel::$channelName = 'alternativeSlackChannel'
```

Make sure you use the right method name on your notifications.

```
class AlternativeSlackChannelNameNotification extends Notification
{
    public function toAlternativeSlackChannel($notifiable) {
        // ...
    }
}
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 58.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~127 days

Recently: every ~289 days

Total

14

Last Release

932d ago

PHP version history (5 changes)1.0.0PHP ^7.1.3

1.5.0PHP ^7.2.0

1.6.0PHP ^7.3.0

1.7.0PHP ^7.3.0|^8.0

1.9.0PHP ^7.3.0|^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/863e91ca13b8c4031f202c0eee4f06b3a4352f92cf9cd397b03609b20247ed16?d=identicon)[beyondcode](/maintainers/beyondcode)

---

Top Contributors

[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (24 commits)")[![sweptsquash](https://avatars.githubusercontent.com/u/9886472?v=4)](https://github.com/sweptsquash "sweptsquash (5 commits)")[![chrysanthos](https://avatars.githubusercontent.com/u/48060191?v=4)](https://github.com/chrysanthos "chrysanthos (4 commits)")[![ecomail-cz](https://avatars.githubusercontent.com/u/64891310?v=4)](https://github.com/ecomail-cz "ecomail-cz (2 commits)")[![matthewnessworthy](https://avatars.githubusercontent.com/u/5653887?v=4)](https://github.com/matthewnessworthy "matthewnessworthy (2 commits)")[![Tlapi](https://avatars.githubusercontent.com/u/2815391?v=4)](https://github.com/Tlapi "Tlapi (1 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1 commits)")[![timacdonald](https://avatars.githubusercontent.com/u/24803032?v=4)](https://github.com/timacdonald "timacdonald (1 commits)")[![augustusnaz](https://avatars.githubusercontent.com/u/51074349?v=4)](https://github.com/augustusnaz "augustusnaz (1 commits)")

---

Tags

laravelnotificationsslack

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/beyondcode-slack-notification-channel/health.svg)

```
[![Health](https://phpackages.com/badges/beyondcode-slack-notification-channel/health.svg)](https://phpackages.com/packages/beyondcode-slack-notification-channel)
```

###  Alternatives

[laravel/slack-notification-channel

Slack Notification Channel for laravel.

89173.4M141](/packages/laravel-slack-notification-channel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4079.7M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M13](/packages/laravel-notification-channels-discord)[awssat/discord-notification-channel

Discord Notification Channel for laravel.

94128.8k](/packages/awssat-discord-notification-channel)[salamwaddah/laravel-mandrill-driver

Mandrill notification channel for Laravel 9, 10, 11, 12, 13

1176.4k](/packages/salamwaddah-laravel-mandrill-driver)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
