Overview
Campaign Management enables users to create scheduled WhatsApp message campaigns for groups or individuals. Each campaign consists of multiple scheduled messages with automatic progress tracking and delivery monitoring.Campaign Lifecycle
1
Create Campaign
Define campaign parameters including target audience, date range, message template, and scheduling options.
2
Schedule Messages
Messages are automatically generated based on the date range and recurrence pattern.
3
Track Progress
Monitor campaign status, message delivery, and completion percentage in real-time.
4
Complete or Update
Campaigns can be updated (before messages are sent) or marked complete when all messages are delivered.
Campaign Status
Campaigns progress through different states:prisma/schema.prisma:19
Creating a Campaign
API Endpoint
src/server/api/routers/messageCampaign.ts:9
Input Parameters
WhatsApp group ID or contact ID for the campaign target
Display name for the group or contact
WhatsApp session ID to use for sending messages
Optional campaign title (displayed in messages unless isFreeForm is true)
Optional contribution target amount for fundraising campaigns
ISO 8601 date string for campaign start (e.g., “2026-03-10”)
ISO 8601 date string for campaign end (must be after startDate)
Time to send messages daily in HH:MM format (e.g., “09:30”)
IANA timezone identifier for scheduling (e.g., “America/New_York”)
Message content. Use asterisks (*) to separate messages for recurring campaigns
If true, only sends the message template without campaign metadata
Whether to send messages on a recurring schedule
Recurrence pattern: DAILY, WEEKLY, SEMI_MONTHLY, MONTHLY, SEMI_ANNUALLY, ANNUALLY
Target audience type: ‘groups’ or ‘individuals’
Message Template Variables
Templates support dynamic variables:{days_left}- Replaced with remaining days in campaign
Multiple Message Sequences
For recurring campaigns, separate messages with asterisks to create unique content for each occurrence:Recurrence Patterns
Recurrence intervals are mapped to day counts:src/server/api/routers/messageCampaign.ts:31
- Daily
- Weekly
- Monthly
Messages sent every day at the specified time
Viewing Campaigns
Active Campaigns
Get campaigns with upcoming scheduled messages:src/server/api/routers/messageCampaign.ts:251
Completed Campaigns
Get campaigns where all messages have been sent or scheduled time has passed:src/server/api/routers/messageCampaign.ts:185
Updating Campaigns
Campaigns can only be updated if no messages have been sent yet. Once messages start sending, the campaign becomes read-only.
src/server/api/routers/messageCampaign.ts:403
1
Validate Access
Verify the campaign belongs to the current user and exists
2
Check Message Status
Ensure no messages have been sent yet
3
Mark Old Messages as Deleted
Soft delete all unsent messages from the original campaign
4
Regenerate Messages
Create new messages based on updated parameters
Deleting Campaigns
Campaigns are soft-deleted to preserve historical data:src/server/api/routers/messageCampaign.ts:319
Campaign Data Model
prisma/schema.prisma:77
Progress Tracking
Track campaign progress through message status:Total Messages
Count of all non-deleted messages in the campaign
Sent Messages
Messages where
isSent = trueFailed Messages
Messages where
isFailed = trueBest Practices
Timezone Handling
Timezone Handling
- Always specify the timezone for accurate scheduling
- Messages are stored in UTC but scheduled in the specified timezone
- Use IANA timezone identifiers (e.g., “America/New_York”)
Message Templates
Message Templates
- Keep messages concise for better engagement
- Use the variable for urgency
- Test templates before creating large campaigns
Campaign Planning
Campaign Planning
- Verify date ranges before creating campaigns
- For recurring campaigns with sequences, calculate required message count
- Use free-form mode for simple announcements
Next Steps
Message Scheduling
Learn about timezone handling and recurrence patterns
Admin Dashboard
Monitor all campaigns across users