Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Slack Alerts

Laravel Slack Alerts Laravel Package

spatie/laravel-slack-alerts

Send Slack alerts from Laravel in one line. Configure a Slack Incoming Webhook via env or config, then dispatch messages through a queued job so your app won’t fail if Slack is unavailable. Great for notifying you about noteworthy events.

View on GitHub
Deep Wiki
Context7

Quickly send a message to Slack

Frequently asked questions about Laravel Slack Alerts
How do I send a basic Slack alert from Laravel using this package?
Use the `SlackAlert` facade to dispatch a message. For example, `SlackAlert::message('Your alert text here')` will queue a job to send the message to Slack. The package handles the async communication, so your app won’t block if Slack is down.
Does this package support Laravel 10.x only, or will it work with older versions?
The package officially supports Laravel 10.x, but it may work with older versions (e.g., 9.x) if you check the release notes. Spatie typically maintains compatibility with the latest LTS Laravel version, so monitor their changelog for updates.
Can I customize Slack messages with attachments, blocks, or interactive buttons?
Yes, the package supports rich Slack formatting. You can pass arrays for attachments or use Slack’s block kit syntax via the `attachments` or `blocks` parameters in the `SlackAlert::message()` method. For example, `SlackAlert::message('Alert', ['blocks' => [...]])`.
What happens if Slack’s API is down or rate-limited when sending alerts?
Alerts are dispatched asynchronously via Laravel’s queue system. If Slack is down, the job will fail gracefully. To handle rate limits, implement retries with exponential backoff in your queue worker or batch alerts. The package doesn’t auto-retry by default.
Is there a way to test Slack alerts in CI/CD without hitting Slack’s API?
Yes, the package provides a fake testing mode. Use `SlackAlert::fake()` in your tests to intercept and assert alerts without sending real messages. Example: `SlackAlert::fake()->assertSent(function ($message) { ... });`.
How do I secure the Slack webhook URL to prevent unauthorized access?
Store the `SLACK_WEBHOOK_URL` in your `.env` file and restrict access to it via Laravel’s environment variables. For higher security, use Slack App tokens (OAuth) instead of webhooks, which require admin approval and offer scopes for better control.
Can I send alerts to multiple Slack channels or users at once?
Yes, you can specify a default channel in the config file (`config/slack-alerts.php`) or override it per message. For user-specific alerts, use the `channel` parameter in `SlackAlert::message()`, e.g., `SlackAlert::message('Alert', ['channel' => '#private-channel'])`.
What queue driver should I use for reliability, and how do I configure it?
Use Redis or a managed queue service (e.g., SQS) for reliability. Configure the queue driver in Laravel’s `.env` (e.g., `QUEUE_CONNECTION=redis`). Ensure your queue worker is running (`php artisan queue:work`) to process alerts. The sync driver is not recommended for production.
Are there any limitations on message size or payload complexity?
Slack has a 4MB message limit, including attachments. For large payloads, chunk data or use Slack’s file uploads. The package doesn’t enforce size limits, so ensure your messages comply with Slack’s API constraints. Test with complex payloads in a staging environment first.
How do I handle failures if the queue worker crashes or Slack is unreachable?
Implement a dead-letter queue (DLQ) to capture failed jobs. Use Laravel’s `retry-after` logic or libraries like `spatie/laravel-queue-failer` to log and retry failed alerts. For critical alerts, consider a fallback mechanism like email notifications via Laravel’s `Notification` system.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport