alepha@docs:~/docs/reference/primitives$
cat $notification.md | pretty
1 min read

#$notification

#Import

typescript
1import { $notification } from "alepha/api/notifications";

#Overview

Creates a notification primitive for managing email/SMS notification templates.

Provides type-safe, reusable notification templates with multi-language support, variable substitution, and categorization for different notification channels.

#Options

Option Type Required Description
name string No
description string No
category string No
critical boolean No
sensitive boolean No Marks the template's rendered variables as personal data
translations Object No
schema T Yes

#Examples

ts
 1class NotificationTemplates { 2  welcomeEmail = $notification({ 3    name: "welcome-email", 4    category: "onboarding", 5    schema: z.object({ username: z.text(), activationLink: z.text() }), 6    email: { 7      subject: "Welcome to our platform!", 8      body: (vars) => `Hello ${vars.username}, click: ${vars.activationLink}` 9    }10  });11 12  async sendWelcome(user: User) {13    await this.welcomeEmail.push({14      variables: { username: user.name, activationLink: generateLink() },15      contact: user.email16    });17  }18}