Skip to content

Campaigns

What this module does

Fertility agencies actively recruit egg donors and gestational carriers through marketing campaigns. This module manages mass email campaigns sent to prospect lists, tracking engagement, and drip sequences (automated follow-up emails).

Business value

Agencies need a steady pipeline of qualified donors and carriers. This module enables agencies to run targeted recruitment campaigns directly from Orchid rather than switching to a separate email marketing tool.

Key files

  • Directoryorchid/
    • Directorymodels/
      • campaign.py Campaign, CampaignFlow, CaseCampaign, CaseCampaignFlow
      • general.py MassEmail — mass email sends
    • Directoryviews/
      • campaign.py 5 KB — campaign admin UI
      • admin.py — mass email creation and list views

Data model

erDiagram
Campaign {
int agency_id
string name
string target_type
string status
}
CampaignFlow {
int campaign_id
int delay_days
string email_template
int position
}
CaseCampaign {
int case_id
int campaign_id
datetime enrolled_at
}
CaseCampaignFlow {
int case_campaign_id
int flow_id
string status
datetime sent_at
}
MassEmail {
int agency_id
string subject
text body
datetime scheduled_at
string status
}
Campaign ||--o{ CampaignFlow : "has steps"
CaseCampaign }|--|| Campaign : "enrolls in"
CaseCampaign ||--o{ CaseCampaignFlow : "tracks steps"

Campaign types

One-time mass emails (MassEmail) — A single bulk email sent to a list of contacts. Common use case: announcing a new donor incentive or informational newsletter. Mass emails are built in /admin and delivered via SendGrid.

Drip campaigns (Campaign + CampaignFlow) — Automated sequences of emails sent over time after a contact is enrolled. For example: “Welcome email on day 0, follow-up on day 3, reminder on day 7.”

When a contact is enrolled in a campaign:

  1. A CaseCampaign record is created
  2. The CampaignFlow steps are scheduled
  3. On each scheduled date, a CaseCampaignFlow record is updated and the email is sent via SendGrid

Gotchas

Campaign emails go through SendGrid. The SENDGRID_API_KEY must be configured in the environment. In local mode, campaign emails are not sent.