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

# Campaigns

> Create and manage bulk messaging campaigns with scheduling, audience targeting, template selection, and real-time analytics through the Zeplo API.

# Campaigns

Zeplo Campaigns let you reach thousands of contacts at once with structured, measurable messaging. Design your campaign, choose a pre-approved template, define your audience through groups or filters, schedule delivery for the optimal time, and track results in real time. Campaigns handle queueing, rate limiting, and compliance so you can focus on content and strategy.

> **Template Campaigns**
>
> Build campaigns around pre-approved WhatsApp templates. Personalize each message with contact-level variables for higher engagement.

> **Scheduling**
>
> Schedule campaigns to start at a specific date and time, including timezone-aware delivery windows that respect your contacts' local time.

> **Contact Targeting**
>
> Target specific contact groups, apply tag-based filters, or define custom audience rules to reach exactly the right people.

> **Campaign Analytics**
>
> Track sent, delivered, read, and failed counts in real time. Export detailed per-contact delivery reports for post-campaign analysis.

## Basic Usage

**JavaScript/TypeScript**

```typescript theme={null}
import { Zeplo } from "@zeplo/sdk";

const zeplo = new Zeplo({ apiKey: process.env.ZEPLO_API_KEY });

// Create a campaign
const campaign = await zeplo.campaigns.create({
  name: "Summer Sale Announcement",
  templateName: "summer_sale_2026",
  language: "en",
  audience: {
    type: "group",
    groupIds: ["grp_abc123", "grp_def456"],
    filters: {
      tags: ["active", "newsletter"],
    },
  },
  schedule: {
    type: "scheduled",
    sendAt: "2026-06-01T09:00:00Z",
    timezone: "America/New_York",
  },
  templateParameters: [
    {
      field: "name",
      source: "contact.name",
    },
    {
      field: "discount",
      value: "25%",
    },
  ],
});

// Start a draft campaign immediately
await zeplo.campaigns.start(campaign.id);

// Get campaign analytics
const analytics = await zeplo.campaigns.getAnalytics(campaign.id);
console.log(`Delivered: ${analytics.delivered} / ${analytics.total}`);
```

**Python**

```python theme={null}
import os
from zeplo import Zeplo

zeplo = Zeplo(api_key=os.environ["ZEPLO_API_KEY"])

# Create a campaign
campaign = zeplo.campaigns.create(
    name="Summer Sale Announcement",
    template_name="summer_sale_2026",
    language="en",
    audience={
        "type": "group",
        "group_ids": ["grp_abc123", "grp_def456"],
        "filters": {
            "tags": ["active", "newsletter"],
        },
    },
    schedule={
        "type": "scheduled",
        "send_at": "2026-06-01T09:00:00Z",
        "timezone": "America/New_York",
    },
    template_parameters=[
        {
            "field": "name",
            "source": "contact.name",
        },
        {
            "field": "discount",
            "value": "25%",
        },
    ],
)

# Start a draft campaign immediately
zeplo.campaigns.start(campaign.id)

# Get campaign analytics
analytics = zeplo.campaigns.get_analytics(campaign.id)
print(f"Delivered: {analytics.delivered} / {analytics.total}")
```

> [!WARNING]
>
> Campaigns use pre-approved templates only. You cannot send free-form messages through campaigns. Make sure your template is approved before scheduling a campaign.

## Campaign Statuses

| Status | Description |
| - | - |
| `draft` | Campaign is created but not yet scheduled or started. Edits are allowed. |
| `scheduled` | Campaign is scheduled for future delivery. Edits are limited. |
| `running` | Campaign is actively sending messages. No edits allowed. |
| `completed` | All messages have been processed. Analytics are final. |
| `failed` | Campaign encountered a critical error and stopped. Check the error log. |
| `paused` | Campaign was manually paused and can be resumed. |

## Best Practices

> Always verify your template is in **approved** status before creating a campaign. Pending or rejected templates will cause the campaign to fail at runtime. Use the Templates API to check status programmatically.

> Segment your audience with groups and tags before launching. Smaller, well-targeted lists consistently outperform large unfiltered ones. Aim for relevance over volume to protect your quality rating.

> Schedule campaigns between **9 AM and 6 PM** in your contacts' local timezone. Avoid weekends for B2B campaigns. Test different send times with small audience segments before a full rollout.

> Wait at least **24 hours** after a campaign completes before drawing conclusions on read rates. Export per-contact reports to identify undeliverable numbers and update your contact database accordingly.

> **[API Reference: List Campaigns](https://docs.zeplo.ai/docs/api-reference/campaigns/list-campaigns.md)**
>
> Explore the full request schema, filtering options, and response format for the campaigns endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.