> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mihu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaign Management

> Create and manage multi-channel communication campaigns

## What are Campaigns?

Campaigns allow you to orchestrate multi-channel communication at scale. Whether you're conducting surveys, sending reminders, or reaching out to leads, campaigns help you organize and automate your outreach.

## Campaign Types

<CardGroup cols={2}>
  <Card title="Voice Campaigns" icon="phone">
    Automated outbound calling with AI agents
  </Card>

  <Card title="WhatsApp Campaigns" icon="message">
    Template-based WhatsApp broadcasts
  </Card>

  <Card title="Mixed Campaigns" icon="layer-group">
    Multi-channel campaigns with sequential touchpoints
  </Card>

  <Card title="Drip Campaigns" icon="droplet">
    Automated sequences with timing rules
  </Card>
</CardGroup>

## Creating a Campaign

### Via Dashboard

<Steps>
  <Step title="Navigate to Campaigns">
    Go to **Campaigns** in your Mihu dashboard
  </Step>

  <Step title="Create New Campaign">
    Click **"Create Campaign"** button
  </Step>

  <Step title="Configure Basic Settings">
    * Campaign name
    * Campaign type (Voice, WhatsApp, Mixed)
    * Description
    * Start and end dates
  </Step>

  <Step title="Select Agent/Template">
    * For voice: Choose an AI agent
    * For WhatsApp: Select message template
    * For mixed: Configure both
  </Step>

  <Step title="Choose Contacts">
    * Upload contact list
    * Select from existing contacts
    * Apply filters and segments
  </Step>

  <Step title="Set Schedule">
    * Immediate or scheduled start
    * Time windows (e.g., 9 AM - 5 PM)
    * Timezone considerations
    * Pacing (calls per hour)
  </Step>

  <Step title="Launch Campaign">
    Review settings and click **"Launch"**
  </Step>
</Steps>

### Via API

Create campaigns programmatically:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://your-tenant.mihu.ai/api/v1/campaigns \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Customer Survey Q1 2025",
      "type": "voice",
      "agentId": "agent-uuid-here",
      "contacts": [
        {"number": "+1234567890", "name": "John Doe"},
        {"number": "+0987654321", "name": "Jane Smith"}
      ],
      "schedule": {
        "startDate": "2025-01-20T09:00:00Z",
        "endDate": "2025-01-25T17:00:00Z",
        "timeWindows": [
          {"start": "09:00", "end": "17:00", "timezone": "America/New_York"}
        ]
      },
      "settings": {
        "maxCallsPerHour": 100,
        "retryFailed": true,
        "maxRetries": 2
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const createCampaign = async () => {
    const response = await fetch(
      'https://your-tenant.mihu.ai/api/v1/campaigns',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer YOUR_API_TOKEN',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          name: 'Customer Survey Q1 2025',
          type: 'voice',
          agentId: 'agent-uuid-here',
          contacts: [
            { number: '+1234567890', name: 'John Doe' },
            { number: '+0987654321', name: 'Jane Smith' }
          ],
          schedule: {
            startDate: '2025-01-20T09:00:00Z',
            endDate: '2025-01-25T17:00:00Z',
            timeWindows: [
              { start: '09:00', end: '17:00', timezone: 'America/New_York' }
            ]
          },
          settings: {
            maxCallsPerHour: 100,
            retryFailed: true,
            maxRetries: 2
          }
        })
      }
    );

    return await response.json();
  };
  ```

  ```python Python theme={null}
  import requests

  url = "https://your-tenant.mihu.ai/api/v1/campaigns"
  headers = {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  }
  payload = {
      "name": "Customer Survey Q1 2025",
      "type": "voice",
      "agentId": "agent-uuid-here",
      "contacts": [
          {"number": "+1234567890", "name": "John Doe"},
          {"number": "+0987654321", "name": "Jane Smith"}
      ],
      "schedule": {
          "startDate": "2025-01-20T09:00:00Z",
          "endDate": "2025-01-25T17:00:00Z",
          "timeWindows": [
              {"start": "09:00", "end": "17:00", "timezone": "America/New_York"}
          ]
      },
      "settings": {
          "maxCallsPerHour": 100,
          "retryFailed": True,
          "maxRetries": 2
      }
  }

  response = requests.post(url, headers=headers, json=payload)
  data = response.json()
  ```
</CodeGroup>

## Campaign Settings

### Scheduling Options

<AccordionGroup>
  <Accordion title="Start Date & Time" icon="calendar">
    When the campaign should begin contacting people. Can be immediate or scheduled for a future date/time.
  </Accordion>

  <Accordion title="End Date & Time" icon="calendar-xmark">
    When the campaign should stop. All pending contacts will be marked as "not contacted" after this time.
  </Accordion>

  <Accordion title="Time Windows" icon="clock">
    Specific hours when contacts can be reached (e.g., 9 AM - 5 PM). Respects recipient timezones.
  </Accordion>

  <Accordion title="Pacing" icon="gauge">
    Control how many contacts are reached per hour to avoid overwhelming your team or systems.
  </Accordion>

  <Accordion title="Retry Logic" icon="rotate">
    Automatically retry failed attempts with configurable retry count and delay.
  </Accordion>
</AccordionGroup>

### Advanced Settings

| Setting         | Description                   | Default |
| --------------- | ----------------------------- | ------- |
| Max Calls/Hour  | Rate limit for outbound calls | 100     |
| Retry Failed    | Retry failed attempts         | true    |
| Max Retries     | Maximum retry attempts        | 2       |
| Retry Delay     | Hours between retries         | 2       |
| Skip Duplicates | Skip duplicate phone numbers  | true    |
| Respect DNC     | Honor Do Not Call lists       | true    |

## Contact Management

### Adding Contacts

<Tabs>
  <Tab title="Manual Entry">
    Add contacts one by one through the dashboard interface.
  </Tab>

  <Tab title="CSV Upload">
    Upload a CSV file with contact information:

    ```csv theme={null}
    name,number,email,custom_field_1
    John Doe,+1234567890,john@example.com,value1
    Jane Smith,+0987654321,jane@example.com,value2
    ```
  </Tab>

  <Tab title="From Contacts Database">
    Select contacts from your existing contact database with filters and segments.
  </Tab>

  <Tab title="Via API">
    Add contacts programmatically when creating or updating campaigns.
  </Tab>
</Tabs>

### Contact Filters

Filter contacts based on:

* **Tags**: Contact tags and labels
* **Custom Fields**: Any custom field values
* **Previous Interactions**: Past campaign participation
* **Status**: Active, inactive, opted-out
* **Location**: Country, state, city
* **Timezone**: Specific timezones

## Campaign Monitoring

### Real-time Dashboard

Monitor campaign progress in real-time:

* **Total Contacts**: Total contacts in campaign
* **Contacted**: Successfully reached
* **Pending**: Not yet contacted
* **Failed**: Failed to reach
* **Success Rate**: Percentage successfully contacted
* **Progress**: Visual progress bar

### Live Activity Feed

See contact-by-contact activity:

```
2:15 PM - Called +1234567890 (John Doe) - Success - Duration: 3:45
2:14 PM - Called +0987654321 (Jane Smith) - No Answer - Retry scheduled
2:13 PM - Called +1122334455 (Bob Wilson) - Success - Duration: 2:30
```

### Webhooks for Campaign Events

Receive real-time updates via webhooks:

```javascript Example Webhook theme={null}
{
  "event": "campaign.contact.completed",
  "timestamp": "2025-01-15T14:15:00Z",
  "data": {
    "campaignId": "campaign-uuid",
    "contactNumber": "+1234567890",
    "contactName": "John Doe",
    "status": "success",
    "duration": 225,
    "callId": "call-uuid"
  }
}
```

See [Webhooks Guide](/webhooks) for setup.

## Campaign Analytics

### Performance Metrics

* **Contact Rate**: Percentage of contacts reached
* **Answer Rate**: Percentage who answered (voice)
* **Completion Rate**: Percentage who completed interaction
* **Average Duration**: Mean interaction time
* **Intent Distribution**: Common intents detected
* **Sentiment Analysis**: Overall sentiment breakdown

### Reports

Generate detailed reports:

1. Go to **Campaigns** → Select campaign
2. Click **"Analytics"** tab
3. Choose metrics and date range
4. **Export** as CSV or PDF

### A/B Testing

Test different approaches:

* **Split Test**: Divide contacts into groups
* **Agent Variations**: Test different agent prompts
* **Template Variations**: Test different messages
* **Timing**: Test different time windows
* **Compare Results**: Analyze which performs better

## Campaign Types in Detail

### Voice Campaigns

Automated calling campaigns with AI agents:

**Best for:**

* Customer surveys
* Appointment reminders
* Lead qualification
* Debt collection
* Emergency notifications

**Configuration:**

* Select AI agent
* Set call windows
* Define success criteria
* Configure retry logic

### WhatsApp Campaigns

Template-based messaging campaigns:

**Best for:**

* Order confirmations
* Shipping updates
* Appointment reminders
* Marketing promotions
* Customer notifications

**Requirements:**

* Approved WhatsApp templates
* Valid phone numbers
* Opt-in consent

### Drip Campaigns

Multi-touch sequences over time:

**Example Flow:**

```
Day 1: Send WhatsApp message
Day 3: Make voice call if no response
Day 7: Send follow-up WhatsApp
Day 14: Final voice call attempt
```

**Configuration:**

* Define sequence steps
* Set delays between steps
* Configure triggers and conditions
* Handle responses

## Best Practices

<AccordionGroup>
  <Accordion title="Segment Your Audience" icon="filter">
    * Group contacts by relevant criteria
    * Personalize messaging for each segment
    * Test different approaches per segment
    * Track segment-specific performance
  </Accordion>

  <Accordion title="Optimize Timing" icon="clock">
    * Call during business hours
    * Consider recipient timezones
    * Avoid holidays and weekends (unless appropriate)
    * Test different time windows
  </Accordion>

  <Accordion title="Monitor and Adjust" icon="sliders">
    * Watch real-time metrics
    * Pause if issues arise
    * Adjust pacing as needed
    * Iterate based on results
  </Accordion>

  <Accordion title="Respect Opt-Outs" icon="ban">
    * Honor Do Not Call lists
    * Process opt-out requests immediately
    * Maintain unsubscribe lists
    * Comply with regulations
  </Accordion>

  <Accordion title="Test Before Launching" icon="vial">
    * Test with small sample first
    * Verify agent/template works correctly
    * Check contact data quality
    * Confirm scheduling is correct
  </Accordion>
</AccordionGroup>

## Managing Active Campaigns

### Pausing a Campaign

```bash theme={null}
curl -X PATCH https://your-tenant.mihu.ai/api/v1/campaigns/{id} \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "paused"}'
```

### Resuming a Campaign

```bash theme={null}
curl -X PATCH https://your-tenant.mihu.ai/api/v1/campaigns/{id} \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "active"}'
```

### Stopping a Campaign

```bash theme={null}
curl -X PATCH https://your-tenant.mihu.ai/api/v1/campaigns/{id} \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "stopped"}'
```

## Compliance

### Regulations

* **TCPA**: Telephone Consumer Protection Act (US)
* **GDPR**: General Data Protection Regulation (EU)
* **CASL**: Canadian Anti-Spam Legislation
* **DNC Lists**: Do Not Call registries

### Best Practices

✅ **Do:**

* Get explicit consent
* Provide opt-out options
* Honor opt-out requests
* Respect calling hours
* Maintain DNC lists

❌ **Don't:**

* Call without consent
* Ignore opt-out requests
* Call outside permitted hours
* Use misleading caller ID
* Harass contacts

## Troubleshooting

### Low Contact Rate

**Possible causes:**

* Poor contact data quality
* Calling outside business hours
* Phone numbers invalid/disconnected
* Agent issues

**Solutions:**

* Validate contact data
* Adjust time windows
* Review agent configuration
* Test with known-good numbers

### High Failure Rate

**Possible causes:**

* Technical issues
* Rate limiting
* Invalid agent configuration
* Network problems

**Solutions:**

* Check campaign logs
* Reduce pacing
* Verify agent settings
* Contact support

## Next Steps

<CardGroup cols={2}>
  <Card title="Voice Agents" icon="microphone" href="/guides/services/voice-agents">
    Create AI agents for campaigns
  </Card>

  <Card title="WhatsApp" icon="message" href="/guides/services/whatsapp">
    Set up WhatsApp messaging
  </Card>

  <Card title="Contacts" icon="address-book" href="/guides/services/contacts">
    Manage your contact database
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference">
    View campaign API endpoints
  </Card>
</CardGroup>
