Sending notifications | laravel-backup-rust | Spatie       

 SPATIE  

laravel-backup-rust
===================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-backup-rust](https://spatie.be/docs/laravel-backup-rust/v1)  Sending-notifications  Sending notifications

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-backup-rust/v1) 

  Sending notifications    
- [ Introduction ](https://spatie.be/docs/laravel-backup-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-backup-rust/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-backup-rust/v1/requirements)
- [ High level overview ](https://spatie.be/docs/laravel-backup-rust/v1/high-level-overview)
- [ Installation and setup ](https://spatie.be/docs/laravel-backup-rust/v1/installation-and-setup)
- [ Questions &amp; issues ](https://spatie.be/docs/laravel-backup-rust/v1/questions-and-issues)
- [ Changelog ](https://spatie.be/docs/laravel-backup-rust/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-backup-rust/v1/about-us)
- [ Testing ](https://spatie.be/docs/laravel-backup-rust/v1/testing)

Taking Backups
--------------

- [ Taking backups ](https://spatie.be/docs/laravel-backup-rust/v1/taking-backups/overview)
- [ Events ](https://spatie.be/docs/laravel-backup-rust/v1/taking-backups/events)

Cleaning up old backups
-----------------------

- [ Cleaning up old backups ](https://spatie.be/docs/laravel-backup-rust/v1/cleaning-up-old-backups/overview)
- [ Events ](https://spatie.be/docs/laravel-backup-rust/v1/cleaning-up-old-backups/events)

Monitoring the health of all backups
------------------------------------

- [ Monitoring the health of all backups ](https://spatie.be/docs/laravel-backup-rust/v1/monitoring-the-health-of-all-backups/overview)
- [ Creating your custom health check ](https://spatie.be/docs/laravel-backup-rust/v1/monitoring-the-health-of-all-backups/creating-your-custom-health-check)
- [ Events ](https://spatie.be/docs/laravel-backup-rust/v1/monitoring-the-health-of-all-backups/events)

Sending notifications
---------------------

- [ Sending notifications ](https://spatie.be/docs/laravel-backup-rust/v1/sending-notifications/overview)
- [ Adding extra notification channels ](https://spatie.be/docs/laravel-backup-rust/v1/sending-notifications/adding-extra-notification-channels)
- [ Customizing the notifiable ](https://spatie.be/docs/laravel-backup-rust/v1/sending-notifications/customizing-the-notifiable)

Advanced Usage
--------------

- [ Adding extra files to a backup ](https://spatie.be/docs/laravel-backup-rust/v1/advanced-usage/adding-extra-files-to-a-backup)
- [ Backing up a non-laravel application ](https://spatie.be/docs/laravel-backup-rust/v1/advanced-usage/backing-up-a-non-laravel-application)
- [ Binary database dumps with PostgreSQL ](https://spatie.be/docs/laravel-backup-rust/v1/advanced-usage/binary-database-dumps-with-postgresql)
- [ Encrypt backup archives ](https://spatie.be/docs/laravel-backup-rust/v1/advanced-usage/encrypt-backup-archives)
- [ Isolated mode ](https://spatie.be/docs/laravel-backup-rust/v1/advanced-usage/isolated-mode)

 Sending notifications
=====================

###  On this page 

1. [ Configuration ](#content-configuration)

- The provider's event handler dispatches Laravel events and sends through `laravel::notification`.
- The built-in channels are `mail`, `slack`, `discord` and `webhook`. Discord and webhook implement native `#[notification::channel]` contracts, including Laravel's queued delivery jobs.

Configuration
-----------------------------------------------------------------------------------------------

- Choose channels for each event and configure typed routes in the backup section:

```
let mut config = spatie_backup::Config::default();
config.notifications.mail.to = vec!["backups@example.com".into(), "operations@example.com".into()];
config.notifications.webhook.url = "https://hooks.example.com/backups".into();
config.notifications.notifications.insert("BackupHasFailed".into(), vec!["mail".into(), "webhook".into()]);
config.notifications.locale = "en".into();
config.notifications.application_name = "My application (production)".into();
config.backup.timezone = "Europe/Rome".into();
```

- The default event map enables mail for `BackupHasFailed`, `BackupWasSuccessful`, `CleanupHasFailed`, `CleanupWasSuccessful`, `HealthyBackupWasFound` and `UnhealthyBackupWasFound`.
- Remove an entry or set its channel list to empty to stop sending for that event. `--disable-notifications` suppresses every channel without suppressing Laravel events or mutable lifecycle hooks.
- Configure the mail transport in Laravel's `config.mail`. Its sender is the default, or set `notifications.mail.from` to a `MailSender` for backup-specific mail. JSON accepts `mail.to` as either a single address or an array.
- Laravel 0.1.0 has log and Resend transports, and optional SES support. Its log transport does not deliver to an inbox. SMTP is not supported upstream. Delivery errors propagate and can fail the command.
- Slack uses `.slack.webhook_url`, or `.slack.channel` with Laravel's `SLACK_BOT_TOKEN` for bot delivery. Its optional `.username` and `.icon` customize message appearance. Incoming webhooks use the channel selected when the webhook was created.
- Discord uses `.discord.webhook_url`, optional `.username` and `.avatar_url`. Embeds include status color, title, body and destination fields. Individual strings and field counts are limited to Discord's bounds.
- Generic webhooks POST the notification's JSON data to `.webhook.url`. It contains the event type, application/disk/backup names and failure details when applicable.
- Empty webhook URLs skip that channel. Unknown channel names fail explicitly. Keep webhook URLs secret; the typed route configs redact them from Debug output.
- Replace message content with an `EventHandler.notifications` factory. For different recipients or custom native notifications, use an application event listener and remove the corresponding built-in channel to avoid duplicate delivery.
- Choose from 31 bundled message catalogs with `notifications.locale`. Unknown locale/key pairs fall back to English.
- Newest and oldest backup dates use `backup.timezone`, formatted as `YYYY/MM/DD HH:MM:SS`.
- Mail is plain text and includes destination/error details; do not put secrets into custom exception messages.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
