Overview
The message scheduling system provides precise control over when WhatsApp messages are sent, with support for multiple timezones, recurring patterns, and automatic message generation based on campaign parameters.Timezone Support
All messages are scheduled with timezone awareness using Luxon for accurate date/time handling.Default Timezone
src/server/api/routers/messageCampaign.ts:20
Timezone Conversion Flow
Storing all times in UTC prevents issues with daylight saving time transitions and ensures consistent scheduling across different server locations.
Time Format Validation
Message times must follow the HH:MM format:src/server/api/routers/messageCampaign.ts:40
- Valid Formats
- Invalid Formats
9:30(9:30 AM)09:30(9:30 AM)14:45(2:45 PM)23:59(11:59 PM)
Recurrence Patterns
The system supports six recurrence patterns with automatic message generation:prisma/schema.prisma:103
Recurrence Intervals
src/server/api/routers/messageCampaign.ts:31
Daily
Messages every day
Interval: 1 day
Weekly
Messages every week
Interval: 7 days
Semi-Monthly
Messages twice per month
Interval: 15 days
Monthly
Messages once per month
Interval: 30 days
Semi-Annually
Messages twice per year
Interval: 182 days
Annually
Messages once per year
Interval: 365 days
Message Generation Algorithm
Messages are automatically generated based on the date range and recurrence pattern:src/server/api/routers/messageCampaign.ts:68
Generation Example
Daily Campaign (March 1-5, 2026)
Daily Campaign (March 1-5, 2026)
Weekly Campaign (March 1-31, 2026)
Weekly Campaign (March 1-31, 2026)
Message Sequences
For recurring campaigns, you can provide unique messages for each occurrence by separating them with asterisks:src/server/api/routers/messageCampaign.ts:75
Sequence Validation
src/server/api/routers/messageCampaign.ts:81
Message Data Model
prisma/schema.prisma:112
Message States
Picked for Delivery
Background worker has picked the message for processing
isPicked: trueisSent: false
Retry Logic
Messages support automatic retry on failure:Date Validation
The system validates date ranges before creating messages:src/server/api/routers/messageCampaign.ts:59
Dates must be provided in ISO 8601 format (YYYY-MM-DD). The system will reject invalid dates or end dates before start dates.
Dynamic Variables
Messages support template variables that are replaced during generation:Replaced with the number of days remaining until campaign end
Variable Replacement
src/server/api/routers/messageCampaign.ts:128
Best Practices
Timezone Selection
Timezone Selection
- Always specify the timezone where your audience is located
- Use IANA timezone identifiers (e.g., “America/New_York”, “Europe/London”)
- Account for daylight saving time by using timezone-aware dates
Scheduling Recommendations
Scheduling Recommendations
- Avoid scheduling messages during late night hours (10 PM - 7 AM)
- Consider your audience’s time zone when selecting message times
- Test with a small campaign before scheduling large-scale campaigns
Message Sequences
Message Sequences
- Calculate required message count before creating sequences
- Use asterisks (*) only when you want unique messages per occurrence
- For repeating messages, use a single template without asterisks
Recurrence Patterns
Recurrence Patterns
- DAILY: Best for time-sensitive campaigns (fundraisers, events)
- WEEKLY: Good for regular updates and newsletters
- MONTHLY: Ideal for membership reminders and billing
- Choose based on audience engagement expectations
Common Use Cases
- Daily Reminders
- Weekly Updates
- One-Time Campaign
Next Steps
Campaign Management
Learn how to create and manage campaigns
Notifications
Configure delivery notifications