How Do I

Define notification types

Register channels, defaults, mandatory rules, and opt-in behavior.

Define each notification type with a stable key and the channels it supports.

config/notificationcompass.php
'definitions' => [
    'security.alert' => [
        'channels' => ['mail', 'database'],
        'mandatory_channels' => ['mail'],
        'metadata' => [
            'label' => 'Security alerts',
            'description' => 'Important security notifications for the account.',
            'category' => 'security',
            'order' => 10,
        ],
        'channel_metadata' => [
            'mail' => ['label' => 'Email', 'visible' => true],
            'database' => ['label' => 'In-app', 'visible' => false],
        ],
    ],
    'digest.weekly' => [
        'channels' => ['mail'],
        'opt_in' => true,
    ],
    'project.issue_updated' => [
        'channels' => ['mail'],
        'requires_context' => true,
        'supported_contexts' => ['project'],
    ],
],

Mandatory channels are always enabled and cannot be changed by the user. Opt-in channels start disabled unless a higher-priority default applies. A definition with requires_context blocks delivery when its resolver cannot provide a context, instead of falling back to global preferences.

Use metadata to describe the notification type and channel_metadata to describe each channel for settings interfaces. The application can sort definitions by metadata.order and hide a channel when its metadata is not visible. These values do not define translations, icons, or a visual component library.

See configuration for the complete definition schema.