Direct mail API for developers and growth teams. Read the docs →

Win-back campaign by API: who to mail, when, and what to send

A win-back campaign brings back customers who stopped buying, booking or paying. By mail, it’s one card per customer, sent when they pass the point where they’d normally have come back, naming what they bought and carrying an offer code of their own. A nightly job picks them from your data and a direct mail API prints and mails the cards. Below: who counts as lapsed in different businesses, when to send, what the card says, and how to tell whether it worked.

On this page
  1. Who counts as lapsed in a win-back campaign by API
  2. When to send a win-back card by API
  3. What a win-back card says, with API merge fields
  4. How to measure a win-back campaign sent by API
  5. Code: a nightly win-back job by API
  6. Win-back campaign questions from API senders

Who counts as lapsed in a win-back campaign by API

“Lapsed” depends on how often a customer normally comes back. These are the lapse points the industry pages on this site use:

BusinessLapsed meansWhat the card names
Online storeNo order in 60 daysThe last product
RestaurantA regular gone 60 daysTheir usual dish
Groomer or kennelNo booking in four monthsThe pet
Cleaning companyA canceled plan, or 60 days without a cleanA return offer
Gym30 days after a membership endsTheir favorite class
Auto repair shopNo visit in a yearTheir vehicle
Software subscriptionA canceled subscriptionWhat shipped since they left

If you know each customer’s own usual gap between orders or visits, use that instead of one number for everyone.

When to send a win-back card by API

Last order: Sep 1460 days, no order sincetmpl_winbackOne card, one code
Mail the lapse, skip the ones who return. The nightly job picks customers past their lapse date, leaves out anyone who ordered again or was already mailed for this lapse, and sends one card each.
  • After email has had its turn. A customer who has gone quiet has often stopped opening your email; the card reaches them somewhere they still look.
  • Once per lapse. Record which lapse each card was for, so nobody gets the same card twice and a customer who returns and lapses again can get one later.
  • Not to people who came back on their own. The win-back template is meant only for customers who haven’t returned, so check for a new order the day you send.
  • As a monthly or nightly batch, rather than one big blast, so each card lands close to the customer’s own lapse date.

What a win-back card says, with API merge fields

Win-back postcard template (6x11), front: Win-backfrontfirst_nameWin-back postcard template (6x11), back with the address area left clear for the mailing address, postage and barcodebacklast_productpromo_code
The 6x11 win-back card. The name on the front, the last product and an offer code on the back, all from the customer’s record.

Mailr’s win-back template is a 6x11 card with three fields: the first name (up to 14 characters), the last product (22) and a promo code (12). Naming what they bought is what makes it read as a note to them rather than an ad. Keep the offer simple and give it an end date. More on which fields to use is in personalized direct mail.

How to measure a win-back campaign sent by API

  • A code per customer. Count the codes used at checkout. Making one-use codes in bulk is covered in coupon mailers.
  • A group you don’t mail. Leave a random tenth out and see how many of them order again anyway. The difference between the two groups is what the card did. The same split with two designs is in direct mail campaign.
  • A window. Decide in advance how long after the card a return counts, and stick to it.

Code: a nightly win-back job by API

This picks customers past 60 days, skips anyone already mailed for this lapse, holds out a tenth, and sends the rest as 6x11 win-back cards with a code of their own:

# Nightly. customers.csv: id, name, first_name, line1, line2, city, state, zip, last_order (YYYY-MM-DD), last_product
# winback_mailed.csv: id, last_order the card was sent for (one card per lapse; this script appends to it)
import csv, datetime, os, random, requests

LAPSE = 60          # days without an order before a customer counts as lapsed
HOLDOUT = 0.1       # leave 10% out, to see how many come back without a card
today = datetime.date.today()

mailed = set()
if os.path.exists("winback_mailed.csv"):
    with open("winback_mailed.csv", newline="") as f:
        mailed = {(r[0], r[1]) for r in csv.reader(f)}

send, held = [], []
with open("customers.csv", newline="") as f:
    for c in csv.DictReader(f):
        days = (today - datetime.date.fromisoformat(c["last_order"])).days
        if days < LAPSE or (c["id"], c["last_order"]) in mailed:  # not lapsed yet, or already mailed for this lapse
            continue
        (held if random.random() < HOLDOUT else send).append(c)

for n, start in enumerate(range(0, len(send), 1000)):
    chunk = send[start:start + 1000]
    r = requests.post("https://api.mailr.dev/v1/batches", timeout=60,
        headers={"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}",
                 "Idempotency-Key": f"winback-{today.isoformat()}-{n}"},
        json={"kind": "postcard", "size": "6x11", "template": "tmpl_winback", "verify": True,
              "recipients": [{"to": {"name": c["name"][:40], "line1": c["line1"], "line2": c["line2"] or None,
                                     "city": c["city"], "state": c["state"], "zip": c["zip"]},
                              "merge": {"first_name": (c["first_name"] or "Neighbor")[:14],
                                        "last_product": (c["last_product"] or "your last order")[:22],
                                        "promo_code": f"BACK{c['id']}"[:12]}} for c in chunk],
              "description": f"Win-back {today.isoformat()}"})
    r.raise_for_status()
    with open("winback_mailed.csv", "a", newline="") as f:
        csv.writer(f).writerows([c["id"], c["last_order"]] for c in chunk)
    print(r.json()["id"], r.json()["count"], r.json()["price"])

print(len(held), "held out this run; compare how many of them order again")
Run it against an mlr_test_ key first: the batches are checked, priced and proofed, and nothing prints or charges.

Win-back campaign questions from API senders

When should a win-back card go out?

When a customer passes the point where they'd normally have come back: 60 days without an order for most stores and restaurants, four months without a booking for a groomer, 30 days after a gym membership ends. Use your own customers' usual gap if you know it.

Should a win-back campaign include an offer?

Most win-back cards on this site carry one: a code that expires, or an offer on the next visit. Make the code the customer's own so you can count who used it.

Why mail instead of another email?

A customer who has gone quiet has often stopped opening your email. A card arrives somewhere they still look.

How many win-back cards should one customer get?

One per lapse. The script records which lapse each card was for, so a customer who comes back and lapses again later can get one again.

What does a win-back campaign cost?

The 6x11 win-back card is $0.99 on pay as you go, printing and postage included, so 1,000 lapsed customers is $990.00.

START SENDING

Put your first postcard in the mail

Create a key, send a test to yourself, and check the proof before anything prints.

Start sending
  • Postcards, flats and folded mailers
  • A proof before anything prints
  • Free test mode: nothing prints, nothing charges
  • A status for every piece

Free price sheet

Get the price sheet by email

Every postcard, letter, mailer and print product on every plan, with postage included.

We’ll email you the price sheet. By continuing you agree to the Terms and Privacy Policy.

Download the template kit?

mailr-kit.zip · about 310 KB · 59 text files

Only HTML, JSON and Markdown files. No programs, scripts or macros, nothing that installs or runs.