# email-campaign

Email marketing & cold-outreach copywriting microservice: generate subject-line variants by proven copy formulas (curiosity, urgency, benefit, question, how-to, number, personalized, FOMO), craft...


An intelligent email-marketing copywriting microservice. Every tool has a deterministic heuristic
core that runs fully offline; the generative tools also try an optional LLM (via `../_shared/llm.js`)
and silently fall back to the heuristic. Results are tagged `mode: 'heuristic' | 'llm'`.

## Tools

| Tool | Args | What it does |
|---|---|---|
| `subjectLines` | `{ topic, audience?, tone?, count?, formulas?, seed? }` | Subject-line variants generated by copy formulas (curiosity, urgency, benefit, question, how-to, number, personalized, FOMO, social-proof, negativity), ranked by open-rate score. Hybrid. |
| `previewText` | `{ topic, tone? }` | Inbox preview/preheader lines (40–90 chars) that complement the subject. Hybrid. |
| `spamScore` | `{ text }` | Deterministic deliverability check: spam-trigger-word list + ALL-CAPS/emoji/`!`/`$`/length heuristics → 0–100 spamScore + reasons + fix recommendation. |
| `abVariants` | `{ subject, count?, seed? }` | Spins a control subject into A/B/C… test variants (one lever each) and predicts a winner by score. |
| `ctaButtons` | `{ goal?, topic?, count? }` | High-converting CTA button labels by campaign goal (signup/sale/download/demo/webinar/reengage/nurture/waitlist). Hybrid. |
| `scoreSubject` | `{ subject }` | Scores + grades (A–F) a single subject line on length, personalization, question/number hooks, and spam risk. |
| `sequenceIdeas` | `{ topic, goal?, steps? }` | Outlines a multi-touch drip/nurture sequence with per-email purpose, send-day offset, suggested subject, and CTA. Hybrid. |

## Example

```js
import pack from './index.js';
await pack.adapters.subjectLines({ topic: 'our new analytics dashboard', tone: 'bold', count: 5 });
pack.adapters.spamScore({ text: 'FREE!!! Buy now and WIN CASH $$$' });
pack.adapters.scoreSubject({ subject: 'Your Q3 report is ready — 3 wins inside' });
```

## DRY boundaries

- Raw NLP (tokenizing, sentiment, generic readability) → `nlp` / `a-text`. This pack owns
  email-marketing copy craft (subject formulas, deliverability, A/B spins, CTAs).
- Web meta tags / SERP snippet previews → `seo` (search). This pack is inbox/preheader/open-rate (email).
- No cross-pack imports except `../_shared/llm.js`.


---
Source: shared/engines/adapters/domain/email-campaign/README.md
Canonical: https://docs.leumas.tech/p/adapters/domain/email-campaign
