Skip to main content

Overview

Traza uses email notifications to keep users informed about important events and updates in the platform. We use Mailgun as our email service provider to handle all email communications.

Technical Implementation

Email Provider

We use Mailgun for sending all our email notifications. The configuration is managed through Firebase Cloud Functions config:
const API_KEY = functions.config().mailgun?.api_key;
const DOMAIN = functions.config().mailgun?.domain;

Trigger Mechanism

Email notifications are triggered through Firebase Cloud Functions that listen to specific Firestore document changes. When certain events occur (like creating a booking), the corresponding Cloud Function is triggered, which then processes the event and sends the appropriate email notification. Example trigger structure:
export const onEventTrigger = functions
  .region("australia-southeast1")
  .firestore.document("collection/{documentId}")
  .onCreate((snap, context) => {
    // Process event and send email
  });

Current Email Notifications

1. New Booking Request

  • Trigger: When a new booking is created in Firestore
  • Recipient: Tattoo Artist
  • Content:
    • Artist receives details about the new booking request
    • Includes customer name, preferred dates, time of day, and service type
  • Opt-out: Not available (critical notification)

Future Considerations

  1. Email Template System
    • Consider implementing a templating system for consistent email styling
    • Make email templates easier to maintain and update
  2. Email Preferences
    • Implement an email preference center for users
    • Allow users to customize which non-critical notifications they receive
  3. Analytics
    • Track email delivery rates
    • Monitor email engagement metrics