Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DataTalksClub/datamailer/llms.txt

Use this file to discover all available pages before exploring further.

Campaigns are bulk email sends targeted at a specific audience and client. Once created as a draft, a campaign moves through a series of statuses as it is queued, snapshotted, and sent. The campaign detail page provides live delivery statistics throughout the lifecycle and lets you filter the recipient list by engagement outcome.

Creating a Campaign

Navigate to /campaigns/new/ to open the campaign creation form. All campaigns start in draft status and can be edited freely until queued.
FieldNotes
subjectEmail subject line, up to 255 characters.
preview_textOptional preview/preheader text shown in inbox previews.
html_bodyFull HTML email body.
text_bodyPlain-text fallback body.
clientThe client whose audience scope and API context applies to this campaign.
audienceThe audience whose subscribed contacts are the potential recipients.
include_tagsTags a contact must have at least one of to be included. Leave empty to include all subscribed contacts.
exclude_tagsTags a contact must have none of to be included. Takes precedence over include rules.
scheduled_atOptional intended send time stored for reference; does not auto-trigger the send.
Edit an existing draft at /campaigns/{id}/edit/. Once a campaign is queued, editing is disabled.

Campaign Statuses

A campaign moves through the following statuses in order:
StatusMeaning
draftBeing composed. Fully editable. Recipient estimate shown on detail page.
queuedQueued for snapshotting. No further edits allowed.
snapshottingRecipient list is being computed and persisted.
sendingIndividual send batches are being dispatched via SES.
sentAll batches dispatched. Final stats available.
cancelledManually cancelled before completion.
failedAn unrecoverable error occurred during send.

Full Campaign Workflow

1

Create a draft

Go to /campaigns/new/, fill in subject, body, client, audience, and any tag filters. Save to create a draft campaign. The campaign detail page at /campaigns/{id}/ shows a live estimate of eligible recipients.
2

Review the draft

Visit /campaigns/{id}/ to review the campaign content and the estimated recipient count. The estimate reflects current subscriptions and tag memberships. Adjust include/exclude tags and return to edit if needed.
3

Queue the campaign

Click Queue on the campaign detail page or POST to /campaigns/{id}/queue/. This triggers an atomic recipient snapshot followed by batch dispatch. The UI confirms the recipient count, skipped count, and batch count.
4

Monitor sending

Refresh /campaigns/{id}/ during the snapshotting and sending phases to watch live counters update. Use the recipient filter tabs to drill into specific outcome groups.
5

Review final stats

Once the campaign reaches sent, all stats are final. Review open rate, click rate, bounce count, and unsubscribe count on the detail page.

Tag-Based Recipient Filtering

Include and exclude tags let you precisely control which subscribed contacts receive a campaign.
  • include_tags — A contact must hold at least one of the listed tags. Leave empty to target all subscribed contacts in the audience.
  • exclude_tags — A contact must have none of the listed tags. Exclusion is evaluated after inclusion, so an excluded contact is always skipped even if they satisfy include conditions.
Tags are stored as slugified strings. The campaign model normalises tag lists automatically when saved.

Campaign Detail and Delivery Stats

The campaign detail page at /campaigns/{id}/ shows the following counters, updated as events arrive:
StatDescription
recipient_countTotal contacts snapshotted as recipients.
sent_countRecipients where a send attempt was made.
skipped_countRecipients skipped at send time due to suppression or ineligibility.
delivered_countConfirmed deliveries via SES delivery notification.
unique_open_countRecipients who opened the email at least once.
open_countTotal open events recorded (includes repeat opens).
unique_click_countRecipients who clicked at least one link.
click_countTotal click events recorded.
unsubscribe_countRecipients who unsubscribed via the email link.
bounce_countHard bounce events received from SES.
complaint_countSpam complaint events received from SES.
Derived rates displayed in the UI:
  • Open rate = unique_open_count / sent_count
  • Click rate = unique_click_count / sent_count
  • Unsubscribe rate = unsubscribe_count / sent_count
  • Bounce rate = bounce_count / sent_count
The recipient table supports the following filter tabs: opened, clicked, not_opened, bounced, unsubscribed, complained, skipped, failed, sent, pending.
Skipped recipients are contacts who were part of the audience snapshot but were ineligible to receive the email at send time. Skip reasons include: unverified (contact has no verified_at), invalid_email (validation status blocks sending), global_unsubscribe, client_unsubscribe, audience_unsubscribe, hard_bounce, complaint, duplicate, and suppressed. Skipped counts are reported in the queue confirmation message and displayed on the detail page.

Build docs developers (and LLMs) love