- How do I install laravel/slack-notification-channel?
- Install it with Composer by running composer require laravel/slack-notification-channel. Then add the channel to your notification's via() method using the 'slack' key, and implement a toSlack() method that returns a SlackMessage. There are no migrations or service providers to register manually, since the package is auto-discovered by Laravel.
- Which Laravel and PHP versions does laravel/slack-notification-channel support?
- The v3.x line tracks recent Laravel majors, with Laravel 12 and Laravel 13 support plus PHP 8.4 support added in the 3.4.x releases, and it targets PHP 8.1 and above. The package major version moves in lockstep with Laravel, so teams on older framework majors need to pin an earlier 2.x or 3.x release. Check the composer.json constraint against your production Laravel version before upgrading.
- Should I use a Slack webhook or a bot token with the Slack API?
- Incoming webhooks are the simplest path: one URL, one fixed channel, no Slack app governance to manage. The Slack Web API with a bot token gives you richer options such as per-message channel targeting, user selection, threading, and Block Kit payloads. Choose webhooks for simple alerts and a bot token when you need routing flexibility, which also means owning Slack app approval, scoped chat:write permissions, and token rotation.
- How do I send a Slack notification to a specific channel or user?
- With the Web API path, call the to() method on your SlackMessage to direct the message to a channel name or a user, and notifications can also be routed on demand. Webhook delivery is bound to whichever channel the webhook was created for, so it cannot be retargeted per message. Keep channel naming conventions consistent so notification code stays readable and avoids typos that fail silently at Slack.
- Can I send Block Kit blocks and attachments with this package?
- Yes. You can build payloads with the fluent SlackMessage, SlackAttachment, and SlackBlock builders, or paste JSON straight from Slack's Block Kit Builder, and recent releases support Block Kit over webhooks as well as the API. The builder mirrors Slack's own payload structure, so invalid blocks are rejected by Slack's API at send time rather than caught locally. Use the package's Block Kit Builder URL helper to iterate on layouts quickly.
- How do I queue Slack notifications in Laravel?
- Notifications that implement ShouldQueue are queued automatically when the Slack channel is in their via() list, so no package-specific configuration is required. This is important for high notification volume, since outbound HTTP calls to Slack should not block a web request. Make sure your queue workers, retries, and failure handling are configured before routing production alerts through Slack.
- How do I test Slack notifications without posting to Slack?
- Use Notification::fake() and assert that the expected notification was sent to the notifiable, which verifies the wiring without any network traffic. To inspect the actual Slack payload, fake the HTTP client and assert on the outgoing request body. Running a nightly digest through the Block Kit Builder or a private test channel is a practical way to catch rendering problems before release.
- Where should I store the Slack webhook URL or bot token?
- Keep both values in environment variables and reference them from config/services.php, never in committed code. Webhook URLs are bearer secrets, so anyone with the URL can post into the target Slack workspace, and bot tokens should be scoped to chat:write only. Rotate credentials on a schedule and treat leaked URLs as an incident that requires revoking the webhook in Slack.
- Does the package support threaded replies and interactive messages?
- Recent releases add threaded replies, letting follow-up notifications post under an earlier message. You can also send interactive payloads containing buttons and actions, but responding to a user's click requires your own Slack request handler endpoint and signature verification. This package handles outbound delivery; interaction handling stays in your application.
- Is laravel/slack-notification-channel actively maintained and safe for production?
- It is a first-party, MIT-licensed Laravel package versioned alongside the framework, with recent releases adding PHP 8.4 and Laravel 12 and 13 support, so it is a low-risk production dependency. The main risks sit with Slack rather than the code: token scope, webhook secrecy, and Block Kit schema changes that fail at Slack's API. If you are not on Laravel or run a heavily customised notification pipeline, evaluate alternatives such as slack-php/slack-php-api instead.