Skip to content

On-Demand Notifications ​

Sometimes you need to send notifications to recipients that aren't associated with a model, or you want to specify the notification target directly. For these cases, you can use the notifyUsing function.

Anonymous Notification Targets ​

ts
import { notifyUsing } from '@holo-js/notifications'

await notifyUsing()
  .channel('email', {
    email: '[email protected]',
    name: 'User Name'
  })
  .channel('broadcast', {
    channels: ['private-user.123']
  })
  .notify(invoicePaid)

Multiple Channels with On-Demand Targets ​

You can specify different targets for different channels:

ts
await notifyUsing()
  .channel('email', {
    email: '[email protected]'
  })
  .channel('database', {
    id: 'user-1',
    type: 'users',
  })
  .notify(invoicePaid)

Holo owns backend runtime concerns. The host framework owns SSR and routing.