• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
saint

saint

saintforgeAI

Public
Like
saintforgeAI
Home
Code
3
backend
4
shared
1
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://saint--c1d99c363fa611f08b3076b3cceeab13.web.val.run
README.md

Email Notification App

A comprehensive email notification system with API endpoints for integration, supporting reminders, alerts, newsletters, and transactional emails.

Features

  • Multiple Notification Types: Reminders, alerts, newsletters, transactional emails
  • Dynamic Recipients: Rule-based recipient selection
  • Webhook Integration: Receive and process webhooks to trigger notifications
  • Form Submission Handling: Process form data and send notifications
  • Template System: Customizable email templates
  • Recipient Management: Store and manage recipient lists with criteria
  • API-First Design: RESTful endpoints for all operations

API Endpoints

Recipients Management

  • POST /api/recipients - Add new recipient
  • GET /api/recipients - List all recipients
  • PUT /api/recipients/:id - Update recipient
  • DELETE /api/recipients/:id - Remove recipient

Templates Management

  • POST /api/templates - Create email template
  • GET /api/templates - List all templates
  • PUT /api/templates/:id - Update template
  • DELETE /api/templates/:id - Delete template

Notifications

  • POST /api/notifications/send - Send immediate notification
  • POST /api/webhooks/notification - Webhook endpoint for triggering notifications
  • POST /api/forms/submit - Form submission endpoint

Analytics

  • GET /api/notifications/history - Get notification history
  • GET /api/notifications/stats - Get sending statistics

Project Structure

β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ database/
β”‚   β”‚   β”œβ”€β”€ migrations.ts    # Database schema setup
β”‚   β”‚   └── queries.ts       # Database query functions
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ recipients.ts    # Recipient management
β”‚   β”‚   β”œβ”€β”€ templates.ts     # Template management
β”‚   β”‚   β”œβ”€β”€ notifications.ts # Notification sending
β”‚   β”‚   β”œβ”€β”€ webhooks.ts      # Webhook handling
β”‚   β”‚   └── forms.ts         # Form submission handling
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ emailService.ts  # Email sending logic
β”‚   β”‚   β”œβ”€β”€ recipientService.ts # Recipient filtering
β”‚   β”‚   └── templateService.ts  # Template processing
β”‚   └── index.ts             # Main API server
β”œβ”€β”€ shared/
β”‚   └── types.ts             # Shared TypeScript types
└── README.md

Usage Examples

Adding Recipients

curl -X POST /api/recipients \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "name": "John Doe", "tags": ["premium", "newsletter"], "preferences": { "notifications": true, "newsletters": true } }'

Creating Templates

curl -X POST /api/templates \ -H "Content-Type: application/json" \ -d '{ "name": "welcome_email", "type": "transactional", "subject": "Welcome {{name}}!", "html": "<h1>Welcome {{name}}</h1><p>Thanks for joining!</p>", "text": "Welcome {{name}}! Thanks for joining!" }'

Sending Notifications

curl -X POST /api/notifications/send \ -H "Content-Type: application/json" \ -d '{ "type": "alert", "template": "system_alert", "criteria": { "tags": ["admin"], "preferences.notifications": true }, "data": { "message": "System maintenance scheduled", "time": "2024-01-15T10:00:00Z" } }'

Environment Variables

No API keys required - uses Val Town's built-in email service.

HTTP
  • index.ts
    saint--c1…13.web.val.run
Code
backendsharedREADME.md
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.