1. Features
  • HMS Sovereign API
  • Get started
    • Authentication
    • Introduction
    • Quickstart
  • Core concepts
    • Assistants
    • Calls
    • Phone Numbers
    • Webhooks
  • Platform
    • Billing & Credits
    • EU Data Sovereignty
    • Voice Selection
    • Whitelabel Portal
  • Webhooks
    • Assistant Request
    • End of Call Report
    • Webhooks Overview
    • Webhook Security
    • Status Update
    • Tool Calls
  • Configuration
    • Analysis Templates
    • Custom Tools
    • SIP Trunks
    • Tool Templates
  • Features
    • AI Generation
    • Autonomous Silence Handling
    • Call Analysis
    • Call Transfers
    • Campaigns Setup
    • Outbound Campaigns
    • Voicemail Detection
    • Web Calls
  • Integrations
    • BYOK Setup
    • Provider Pricing
    • xAI Grok Integration
  • Reference
    • Error Codes
    • Rate Limits
    • Troubleshooting
Documentation
API Reference
Documentation
API Reference
Book a meeting
Linkedin
Github
  1. Features

Campaigns Setup

Overview#

Outbound campaigns allow you to upload a list of leads and have the system automatically call them sequentially with personalized context.

Architecture#

Flow:
1.
User creates campaign with CSV of leads
2.
User starts campaign (status → scheduled)
3.
Edge Function processes first lead
4.
Call happens via LiveKit droplet
5.
When call ends, database trigger fires
6.
Trigger calls Edge Function to process next lead
7.
Repeat until all leads processed
Components:
Next.js UI: Campaign creation, management, monitoring
Supabase Database: Campaigns, leads, triggers
Supabase Edge Function: Campaign processing logic
LiveKit Droplet: Call execution

Setup Instructions#

1. Deploy Edge Function#

2. Configure Environment Variables#

In Supabase Dashboard → Settings → Edge Functions:
DROPLET_INTERNAL_URL: Your LiveKit droplet URL (e.g., http://142.93.xxx.xxx:8082)
DROPLET_INTERNAL_KEY: Your droplet internal authentication key

3. Configure Database#

Run these SQL commands in Supabase SQL Editor:

4. Optional: Cron Backup#

For extra reliability, add a cron job:
Dashboard → Integrations → Cron:
Name: process-campaigns-backup
Schedule: */2 * * * *
Type: HTTP Request
Method: POST
URL: https://YOUR_PROJECT_REF.supabase.co/functions/v1/process-campaign
Headers:
{
  "Authorization": "Bearer YOUR_SERVICE_ROLE_KEY",
  "Content-Type": "application/json"
}
Body: Check all active campaigns (requires Edge Function modification)

Campaign Lifecycle#

Status Flow:
draft → Campaign being created
scheduled → Active, will process leads during time window
paused → Manually paused by user
completed → All leads processed
Lead Status Flow:
pending → Waiting to be called
calling → Call in progress
completed → Call finished successfully
failed → Call failed or errored

Monitoring#

View Edge Function Logs:
Check Campaign Stats:
Query the campaigns table for completed_leads, failed_leads, and total_leads.
Debug Stuck Campaigns:
Check last_lead_processed_at - if older than 5 minutes and status is scheduled, campaign may be stuck.

Troubleshooting#

Campaigns not processing:
1.
Check Edge Function deployment: supabase functions list
2.
Verify database settings: SELECT name, setting FROM pg_settings WHERE name LIKE 'app.%';
3.
Check Edge Function logs for errors
4.
Verify droplet is accessible from Supabase
Calls not initiating:
1.
Check droplet logs
2.
Verify organization has active phone number and SIP trunk
3.
Verify organization has sufficient balance
4.
Check Edge Function logs for detailed error
Time window not working:
1.
Verify campaign timezone is correct
2.
Check schedule_start_time and schedule_end_time format (HH:MM:SS)
3.
Edge Function logs will show "Outside time window" message
Modified at 2026-03-17 10:59:50
Previous
Call Transfers
Next
Outbound Campaigns
Built with