ObjectStackObjectStack

Notification

Notification protocol schemas

Email Template Schema

Defines the structure and content of email notifications.

Supports variables for personalization and file attachments.

@example


\{

"id": "welcome-email",

"subject": "Welcome to \{\{company_name\}\}",

"body": "<h1>Welcome \{\{user_name\}\}!</h1>",

"bodyType": "html",

"variables": ["company_name", "user_name"],

"attachments": [

\{

"name": "guide.pdf",

"url": "https://example.com/guide.pdf"

\}

]

\}

Source: packages/spec/src/system/notification.zod.ts

TypeScript Usage

import { EmailTemplate, InAppNotification, NotificationChannel, NotificationConfig, PushNotification, SMSTemplate } from '@objectstack/spec/system';
import type { EmailTemplate, InAppNotification, NotificationChannel, NotificationConfig, PushNotification, SMSTemplate } from '@objectstack/spec/system';

// Validate data
const result = EmailTemplate.parse(data);

EmailTemplate

Properties

PropertyTypeRequiredDescription
idstringTemplate identifier
subjectstringEmail subject
bodystringEmail body content
bodyTypeEnum<'text' | 'html' | 'markdown'>Body content type
variablesstring[]optionalTemplate variables
attachmentsObject[]optionalEmail attachments

InAppNotification

Properties

PropertyTypeRequiredDescription
titlestringNotification title
messagestringNotification message
typeEnum<'info' | 'success' | 'warning' | 'error'>Notification type
actionUrlstringoptionalAction URL
dismissiblebooleanUser dismissible
expiresAtnumberoptionalExpiration timestamp

NotificationChannel

Allowed Values

  • email
  • sms
  • push
  • in-app
  • slack
  • teams
  • webhook

NotificationConfig

Properties

PropertyTypeRequiredDescription
idstringNotification ID
namestringNotification name
channelEnum<'email' | 'sms' | 'push' | 'in-app' | 'slack' | 'teams' | 'webhook'>Notification channel
templateObject | Object | Object | ObjectNotification template
recipientsObjectRecipients
scheduleObjectoptionalScheduling
retryPolicyObjectoptionalRetry policy
trackingObjectoptionalTracking configuration

PushNotification

Properties

PropertyTypeRequiredDescription
titlestringNotification title
bodystringNotification body
iconstringoptionalNotification icon URL
badgenumberoptionalBadge count
dataRecord<string, any>optionalCustom data
actionsObject[]optionalNotification actions

SMSTemplate

Properties

PropertyTypeRequiredDescription
idstringTemplate identifier
messagestringSMS message content
maxLengthnumberMaximum message length
variablesstring[]optionalTemplate variables

On this page