Templates

Templates are the email/SMS/push messages PAD sends. Two ways to author them: in the dashboard (DB-backed) or in code (React Email).

Dashboard-authored (recommended)

Visit /dashboard/templates → New template. Drop in HTML with {{handlebars}} variables, declare the variable schema, hit Publish. Use the AI assist button to draft a new version that follows your brand voice.

Variables

Reference variables in subject + body with {{name}}. Unknown variables substitute as empty strings (no errors). Nested keys with dot notation: {{user.firstName}}.

Resolution order

  1. DB template published in this workspace with matching slug ⇒ used
  2. Code-defined template registered in @pad/templates ⇒ used as fallback
  3. Neither ⇒ send fails with failed status and reason

Categories

  • transactional — receipts, magic links, password resets. Sent regardless of consent (legal basis: legitimate interest / fulfillment).
  • marketing — campaigns, newsletters, drips. Requires explicit consent.

Code-defined templates

Drop a React Email component in packages/templates/src/components/ and register it in registry.ts. Useful for layouts you want versioned in git alongside the product.

import { Html, Heading, Text } from '@react-email/components';

export const welcomeTemplate = {
  slug: 'welcome',
  name: 'Welcome',
  category: 'transactional' as const,
  channels: ['email'] as const,
  defaultVariables: { firstName: 'there' },
  Component: ({ firstName }: { firstName: string }) => (
    <Html>
      <Heading>Welcome, {firstName}.</Heading>
      <Text>Glad to have you.</Text>
    </Html>
  ),
};