Every dunning system built before 2023 uses templates. Template + merge fields + a friendly signature. It works, and it's boring, and it leaves recovery revenue on the table.
Modern LLMs write per-customer recovery messages that are meaningfully better than any template — when you constrain them properly. Here's how RRLabs runs it in production.
# Why templates cap out
A template can't know:
- Whether this customer is a 3-year power user or a 3-week trial converter.
- Whether their failure code was insufficient funds (embarrassing) or expired card (routine).
- Whether their product usage was heavy last week (real pain if they lose access) or dormant (may not care).
- Whether the last human interaction was a support win or a complaint.
An LLM with the right context can. The gap is not "AI copy is a little better." The gap is 15–25% lift on step-1 recovery for teams that switch correctly.
# The prompt structure that works
Three layers:
System (immutable):
You are the recovery-messaging assistant for {{workspace_name}}. You write short, warm, factual messages to help customers resolve a failed payment. Never invent facts. Never threaten. Never use exclamation marks unless the customer's own voice does. Output valid JSON with fields: subject, preheader, body_markdown.
Brand voice (per workspace):
{{workspace_name}} is a {{workspace_description}}. Voice: {{voice_traits}}. Words we never use: {{forbidden_words}}. Words we prefer: {{preferred_words}}. Signature persona: {{sender_name}}, {{sender_title}}.
Situation (per customer):
Failure code: {{code}}. Amount: {{amount}} {{currency}}. Plan: {{plan}}. Tenure: {{tenure_months}} months. Recent usage summary: {{usage_summary}}. Cadence step: {{step_number}} of {{total_steps}}. Update-payment URL: {{url}}.
# Guardrails, non-negotiable
- JSON output, always. Free-form text drift is where safety issues creep in.
- Length limits enforced post-generation, not just in the prompt. Regenerate or truncate.
- Denylist scanner for forbidden phrases ("act now", "final notice", exclamation-heavy urgency).
- Fact scanner — every dollar amount, date, or feature name in the output must appear in the input. Anything else is a hallucination and rejected.
- Fallback to template on any guardrail miss. Recovery must never block on the LLM.
# The model choice question
For recovery copy specifically, model choice matters less than most teams think. Gemini Flash, GPT-4o mini, Claude Haiku all perform similarly at this task when the prompt is well-structured. What matters more:
- Latency budget. Generate in <2s or fall back to template.
- Cost budget. At $0.001 per generation, this is trivial. At $0.03, it's real money at scale.
- Reliability. Retries, timeouts, circuit breakers. A recovery send that hangs on the LLM is worse than a template send that ships.
RRLabs uses multi-model routing via OpenRouter (DeepSeek + Gemini fallbacks) for its own recovery pipeline. Sub-second p50, generous rate limits, transparent per-model cost tracking.
# Privacy: what NEVER goes to the LLM
Ever:
- Card numbers, expiry, CVV — even redacted.
- Full billing addresses.
- Government IDs.
- Bank account numbers or IBANs.
- Anything that would be flagged as PCI/PII by a serious auditor.
What can go:
- First name only.
- Product-usage summary (numeric or categorical).
- Failure code (from the payment provider).
- Amount, currency, plan name.
- Tenure in months.
If you can't answer "would I be comfortable if this exact payload were logged forever" with yes, it doesn't go to the LLM.
# Operational patterns that keep quality high
- Human review of 5% of outputs, weekly. Cheap insurance against drift.
- Regeneration budget of one retry. Two makes latency intolerable, zero fails too often.
- Per-workspace fine-tuning is usually unnecessary. Good prompts beat weak fine-tunes for this task.
- Version your prompts. Every generation logs the prompt version. When a prompt regresses, you know exactly what changed.
# Measuring the lift
Run a two-week A/B: 50% template, 50% AI-generated, same cadence, same everything else. Compare:
- Step-1 recovery rate.
- Reply rate.
- Downstream retention at 30 days.
If AI generation is set up well, you'll see 15–25% relative lift on step 1 and 3–8% on reply rate. If you don't, your prompts or guardrails are the problem, not the model.