One notification, every channel the user has.

Send a notification to a notifiable and it is delivered to each channel it asks for: the database (an in-app bell), mail, Discord.

What you get

  • Channels: database, mail and Discord.
  • A receipt records what was delivered where; a channel that failed is a NotificationFailed event.
  • Honest limit: notifications are not queued yet — queue a job that sends one.

In the docs

src/app/notifications/post_live.rs
// One notification, every channel the user can be reached on: the
// database (the in-app bell), mail, Discord.
Notify::instance().send(&author, &PostLive { post }).await?;

impl Notifiable for User {
    fn notifiable_id(&self) -> String {
        self.id.to_string()
    }

    fn notifiable_type(&self) -> &'static str {
        "User"
    }

    fn route_for(&self, channel: &str) -> Option<String> {
        match channel {
            "mail" => Some(self.email.clone()),
            _ => None,
        }
    }
}

Up close

Select an image to see it full size.

The database channel stores each notification for the bell menu; the API reads them back with an unread count.
Sending returns a receipt of what each channel did, so the job can log exactly where the notification went.
One notification, three channels, visible as children of the notification span.
All features

Type to search 2.0.0 docs.