- Add SMTP fields to TicketEmailSettings model (host, port, TLS/SSL, credentials, from email/name) - Update serializers with SMTP fields and is_smtp_configured flag - Add TicketEmailTestSmtpView for testing SMTP connections - Update frontend API types and hooks for SMTP settings - Add collapsible IMAP and SMTP configuration sections with "Configured" badges - Fix TypeScript errors in mockData.ts (missing required fields, type mismatches) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.6 KiB
4.6 KiB
Email Templates & Messaging TODO
Completed Features
Email Template System (Implemented)
- EmailTemplate model with BUSINESS and PLATFORM scopes
- Categories: Appointment, Reminder, Confirmation, Marketing, Notification, Report, Other
- Template variables:
{{BUSINESS_NAME}},{{CUSTOMER_NAME}},{{APPOINTMENT_DATE}}, etc. - Backend API (CRUD, preview, duplicate)
- Frontend Email Templates page with list/create/edit/delete
- EmailTemplateForm component with code editor and preview
- EmailTemplateSelector component for plugin configuration
- Plugin config support for
email_templatetype variables - Footer enforcement for FREE tier tenants
- Default templates seed command (
python manage.py seed_email_templates)
Default Email Templates Created
- Appointment Confirmation
- Appointment Reminder - 24 Hours
- Appointment Reminder - 1 Hour
- Appointment Rescheduled
- Appointment Cancelled
- Thank You - Appointment Complete
- Welcome New Customer
Ticket Email Templates (Added)
- Ticket Assigned - Notification to staff when assigned
- Ticket Status Changed - Status update notification
- Ticket Reply - Staff Notification - When customer replies
- Ticket Reply - Customer Notification - When staff replies
- Ticket Resolved - Resolution confirmation
Plugin Documentation Updated
- Documented
email_templatevariable type in SCHEDULER_PLUGIN_SYSTEM.md - Added template variable types table (text, textarea, email, number, url, email_template)
- Added ticket-related insertion codes to template_parser.py
Pending Features
Customer Onboarding Email Process
- Welcome email when customer creates account
- Email verification workflow
- First booking celebration email
- Loyalty program introduction email (if enabled)
Internal Staff Messaging System
- Message model (sender, recipient, subject, body, read status)
- Conversation threading
- Messaging UI in sidebar/header
- Unread count badge
- Push notifications for new messages
- Email notification option for messages
Ticket Email Notifications
- Email templates created (see "Ticket Email Templates" in Completed)
- Ticket email notification service (
tickets/email_notifications.py)- TicketEmailService class with methods for each notification type
- Renders email templates with ticket context variables
- Falls back to default text templates if custom templates not found
- Includes Reply-To header with ticket ID for email threading
- Django signals to trigger emails on ticket events (
tickets/signals.py)- Pre-save handler to track state changes (assignee, status)
- Post-save handlers for assignment, status change, and resolution
- Comment handler for reply notifications
- Reply-To header with ticket ID for inbound processing
- Format:
support+ticket-{id}@{domain} - X-Ticket-ID header for easy parsing
- Format:
Email Reply Forwarding (Inbound Email Processing)
- Setup inbound email handling (mail.talova.net integration)
- Parse incoming emails to support@smoothschedule.com (or per-tenant)
- Extract ticket ID from subject line or headers
- Create ticket reply from email content
- Notify assignee of new reply
- Handle attachments
Email Server Details
Current email server: mail.talova.net
Test account: poduck@mail.talova.net
Inbound Email Options
-
Mailgun/SendGrid Inbound Routes
- Forward to webhook endpoint
- Parse and process programmatically
- Best for scalability
-
IMAP Polling
- Connect to mail.talova.net via IMAP
- Poll for new messages periodically
- Process and delete/archive
-
Email Piping
- Configure MTA to pipe emails to a Django management command
- Real-time processing
- Requires server access
Platform vs Business Templates
Platform Templates (Scope: PLATFORM)
Used for system-wide emails:
- Tenant invitation
- Platform announcements
- System notifications
Business Templates (Scope: BUSINESS)
Per-tenant customizable templates:
- Appointment confirmations
- Reminders
- Customer communications
- Marketing emails
Running the Seed Command
# Seed templates for all tenant schemas
docker compose -f docker-compose.local.yml exec django python manage.py seed_email_templates
# Seed for specific schema
docker compose -f docker-compose.local.yml exec django python manage.py seed_email_templates --schema=demo
# Reset to defaults (overwrites existing)
docker compose -f docker-compose.local.yml exec django python manage.py seed_email_templates --reset