Campaign Management Overview
Campaign management involves viewing, editing, controlling execution, and monitoring performance. All operations respect organization context and role-based permissions.Viewing Campaigns
Campaign List
The campaigns list displays all accessible campaigns based on view mode and permissions. View Modes: My Campaigns (view_mode=own):
- Shows only campaigns you created
- Default view for all users
- In organization mode: Shows your campaigns within organization
- In personal mode: Shows your personal campaigns
view_mode=all):
- Shows all campaigns in organization
- Only available to Owner/Admin roles
- Requires
admin_view_enabled = truesetting - Members cannot access this view (falls back to “own”)
- Shows campaigns with
organization_id = NULL - Complete isolation from organization data
- Only your own campaigns visible
Campaign Details
Click campaign name to view detailed information: Overview Tab:- Campaign metadata (name, description, status)
- Telegram account information
- Creation and update timestamps
- Creator information (in org mode)
- Visual representation of flow
- Read-only view of nodes and edges
- Shows current flow configuration
- List of all contacts in campaign
- Execution status per contact
- Add/remove contacts functionality
- Filter and search contacts
- Real-time campaign metrics
- Execution breakdown by status
- Message statistics (sent, delivered, failed)
- Response rates and completion rates
- Recent activities (last 20 log entries)
- Complete audit trail of all executions
- Filter by execution, node type, status
- Search by contact name or message content
- Export logs for compliance
Permissions
View Permissions
Own Campaigns:- All roles can view own campaigns
- Always accessible regardless of organization settings
- Owner/Admin: Can view if
admin_view_enabled = true - Member: Cannot view (even if
admin_view_enabled = true) - Campaign must belong to same organization
- Users can only view campaigns with
organization_id = NULL - Complete isolation from organization data
Edit Permissions
Own Campaigns:- All roles can edit own campaigns
- Subject to status-based restrictions (see below)
- Owner: Can edit any organization campaign (regardless of status)
- Admin: Can edit any organization campaign (regardless of status)
- Member: Cannot edit other members’ campaigns
draft,paused,scheduled: Can edit flow configurationactive: Cannot edit flow (must pause first)completed,cancelled: Cannot edit (historical record)
Delete Permissions
Own Campaigns:- All roles can delete own campaigns
- Soft delete:
deleted_attimestamp set - Statistics and logs preserved
- Owner: Can delete any organization campaign
- Admin: Can delete any organization campaign
- Member: Cannot delete other members’ campaigns
Campaign Actions
Launch Campaign
Start a campaign to begin processing executions. Requirements:- Campaign status:
draftorpaused - Campaign must be enabled (
enabled = true) - Telegram account must be connected and healthy
- At least one contact must be selected
- Status changes to
active(orscheduledif scheduled) - Paused executions resume (status:
pending) - Completed executions reset (status:
pending,current_node_id = null) next_execution_atset tonow()for immediate processing- Worker picks up executions on next cycle
- Owner: Can launch own campaigns
- Admin: Can launch own campaigns
- Member: Can launch own campaigns
- Cannot launch other members’ campaigns (even with view access)
Pause Campaign
Temporarily stop an active campaign. Pause Process:- Campaign status changes to
paused - All active executions paused (status:
paused) next_execution_atpreserved (resume from same point)- Flow configuration can be edited
- Launch campaign again to resume
- Executions continue from where they stopped
- No progress lost
- Owner: Can pause own campaigns
- Admin: Can pause own campaigns
- Member: Can pause own campaigns
- Cannot pause other members’ campaigns
Stop Campaign
Immediately stop a campaign and cancel all executions. Stop Process:- Campaign status changes to
cancelled - All active executions cancelled (status:
cancelled) completed_attimestamp seterror_message: “Campaign stopped by user”- Cannot be resumed (must duplicate to restart)
- Owner: Can stop own campaigns
- Admin: Can stop own campaigns
- Member: Can stop own campaigns
- Cannot stop other members’ campaigns
Edit Campaign
Modify campaign settings and flow configuration. What Can Be Edited: Always Editable (regardless of status):- Campaign name
- Description
- Telegram account
- Timezone
- A/B test settings (if not active)
- Response handling settings
- Flow configuration (nodes, edges): Only if
draft,paused, orscheduled - Cannot edit flow if
active,completed, orcancelled
- Active campaigns: Must pause before editing flow
- Completed campaigns: Cannot edit (historical record)
- Cancelled campaigns: Cannot edit (historical record)
- Owner: Can edit own campaigns (subject to status)
- Admin: Can edit own campaigns (subject to status)
- Member: Can edit own campaigns (subject to status)
- Owner/Admin: Can edit other members’ campaigns (subject to status)
- Member: Cannot edit other members’ campaigns
Duplicate Campaign
Create a copy of an existing campaign. Duplication Process:- New campaign created with name:
"{original_name} (Copy)" - Flow configuration copied (nodes, edges)
- Settings copied (timezone, Telegram account, A/B test config)
- Status set to
draft - No contacts assigned (must add manually)
- Create variations for A/B testing
- Test changes without affecting original
- Reuse successful campaign structure
- Owner: Can duplicate own campaigns
- Admin: Can duplicate own campaigns
- Member: Can duplicate own campaigns
- Owner/Admin: Can duplicate other members’ campaigns (if can view)
- Member: Cannot duplicate other members’ campaigns
Delete Campaign
Permanently remove a campaign (soft delete). Delete Process:deleted_attimestamp set- Campaign hidden from list (soft delete)
- Statistics and logs preserved
- Executions preserved (for audit trail)
- Can be restored (if needed)
- Owner: Can delete own campaigns
- Admin: Can delete own campaigns
- Member: Can delete own campaigns
- Owner/Admin: Can delete other members’ campaigns
- Member: Cannot delete other members’ campaigns
Enable/Disable Campaign
Enable Campaign
Enable a disabled campaign to allow launching. Enable Process:enabledflag set totrue- Campaign can be launched
- Previously cancelled executions remain cancelled
- Does not automatically start campaign
- Re-enable after maintenance
- Enable after fixing issues
- Prepare campaign for launch
Disable Campaign
Disable a campaign to prevent launching and stop active executions. Disable Process:enabledflag set tofalse- Campaign cannot be launched
- All active executions immediately cancelled
- Status remains unchanged (can be
active,paused, etc.)
- Emergency stop without deleting
- Temporarily prevent launches
- Disable problematic campaigns
- Pause: Temporarily stops, can resume
- Disable: Prevents launching, cancels executions
- Disabled campaigns cannot be launched until re-enabled
Contact Management
Adding Contacts
Add contacts to campaign (works for any status). During Campaign Creation:- Select contacts from available list
- Executions created when campaign saved
- Use “Add Contacts” button on campaign detail page
- Select contacts from available list
- Executions created with status
pending - For active campaigns: Executions processed immediately
- For completed campaigns: Campaign reactivated to
active
- One execution per contact
- Status:
pending next_execution_at:now()for immediate processing- Context initialized with contact data
- Duplicate contacts skipped (execution already exists)
Removing Contacts
Remove contacts from campaign. Remove Process:- Select contacts to remove
- Executions deleted (soft delete)
- Progress lost for removed contacts
- Campaign statistics updated
- Owner: Can remove contacts from own campaigns
- Admin: Can remove contacts from own campaigns
- Member: Can remove contacts from own campaigns
- Owner/Admin: Can remove contacts from other members’ campaigns
- Member: Cannot remove contacts from other members’ campaigns
Campaign Statistics
Real-Time Metrics
Execution Metrics:total_contacts: Total leads in campaigncontacts_started: Executions that began processingcontacts_completed: Executions that finished successfullycontacts_failed: Executions that failedcontacts_active: Currently processing executionscontacts_responded: Leads who replied
messages_sent: Total messages sentmessages_failed: Failed send attemptsmessages_delivered: Confirmed deliveriesmessages_not_sent: Pending sends
completion_rate: (completed / total) × 100response_rate: (responded / delivered) × 100delivery_rate: (delivered / sent) × 100
Statistics Calculation
Database Function:- Statistics computed by
get_campaign_statistics()function - Aggregates data from executions, logs, and messages
- Cached for performance (refreshed every 5 minutes)
- Statistics update as executions progress
- Refresh button available for manual update
- Auto-refresh every 30 seconds on statistics page
- Available via
/campaign-flows/{id}/statisticsendpoint - Displayed on campaign detail page
- Used for performance monitoring
Recent Activities
Activity Feed:- Last 20 log entries from all executions
- Shows node executions, message sends, responses
- Filtered by importance (sendMessage, delivery, response, etc.)
- Sorted by
executed_at(newest first)
message_sent: Message sent to leadcampaign_activity: Other node executionsresponse_detected: Lead replieddelivery_confirmed: Message delivered
Troubleshooting
Campaign Not Sending
Check:- Campaign status is
active - Campaign is enabled (
enabled = true) - Telegram account is connected and healthy
- Contacts are selected and executions exist
- Rate limits not exceeded
- Flow configuration is valid
- Account disconnected: Reconnect Telegram account
- Rate limit exceeded: Wait for cooldown or adjust limits
- No executions: Add contacts to campaign
- Invalid flow: Check flow configuration for errors
Campaign Stuck
Symptoms:- Executions remain in
pendingorrunningstatus - No progress for extended period
- Worker is running (check worker logs)
- Executions have valid
next_execution_at - Rate limits not blocking execution
- Telegram account is healthy
- Pause and resume campaign
- Check worker logs for errors
- Verify rate limit configuration
- Restart worker if needed
Cannot Edit Campaign
Check:- Campaign status allows editing (
draft,paused,scheduled) - You have edit permissions (owner or admin)
- Campaign is not locked by another process
- Pause campaign before editing flow
- Check your role and permissions
- Refresh page and try again
- Contact support if issue persists
Statistics Not Updating
Check:- Statistics cache (refreshes every 5 minutes)
- Executions are actually progressing
- Database function is working
- Click refresh button
- Wait for cache refresh (5 minutes)
- Check execution logs for activity
- Contact support if issue persists
Best Practices
- Monitor Regularly: Check campaign progress and statistics frequently
- Use Pause: Pause instead of stop when temporarily halting
- Review Logs: Check audit logs for debugging and compliance
- Test First: Test campaigns with small audience before full launch
- Respect Permissions: Understand role-based access controls
- Document Changes: Use description field to note changes
- Monitor Rate Limits: Watch account health and rate limit usage
- Optimize Based on Data: Use statistics to improve campaigns
