> ## Documentation Index
> Fetch the complete documentation index at: https://docs-terra.withunify.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Notifications

> Email and SMS notifications with the Notification Hub

# Notifications

> Send email and SMS notifications to applicants on submission and status changes.

## Channels

| Channel | Provider | Use Case                            |
| ------- | -------- | ----------------------------------- |
| Email   | Resend   | Submission receipts, status updates |
| SMS     | Twilio   | Quick confirmations, reminders      |

## Notification Hub

Manage providers, templates, and delivery from one place:

```mermaid theme={null}
flowchart LR
    Event[Event] --> Hub[Notification Hub]
    Hub --> Email[Email via Resend]
    Hub --> SMS[SMS via Twilio]
    Hub --> Log[(Event Log)]
```

## Event Types

| Event                | Trigger            |
| -------------------- | ------------------ |
| `submission_receipt` | Form submitted     |
| `status_change`      | Status updated     |
| `reminder`           | Scheduled reminder |

## Template System

Custom templates with variable interpolation:

```
Hello {{applicant.name}},

Your application for {{form.title}} has been {{submission.status}}.

Reference: {{submission.reference_id}}
```

## Configuration

### Per-Form Settings

* Enable/disable email and SMS
* Select notification fields (email, phone)
* Choose templates per event

### Sending

```typescript theme={null}
await sendNotification({
  formId,
  submissionId,
  eventType: "submission_receipt",
  email: {
    to: applicantEmail,
    subject: "Application Received",
    templateParams: { ... },
  },
  sms: {
    to: applicantPhone,
    body: "Your application was received. Ref: RENT-2024-001",
  },
});
```

## Delivery Tracking

All notifications are logged:

```sql theme={null}
SELECT * FROM notification_events
WHERE submission_id = $1
ORDER BY sent_at DESC;
```

***

<CardGroup cols={2}>
  <Card title="Queue Architecture" icon="clock" href="/core-systems/async/queue-architecture">
    Async delivery
  </Card>

  <Card title="Webhooks" icon="webhook" href="/core-systems/async/webhooks">
    External notifications
  </Card>
</CardGroup>
