Big sales days like Cyber Monday bring in a wave of new customers. Then most businesses go quiet. A short follow-up sequence fixes that, and you can build the logic behind one in about 40 lines of Python.
The goal
Each day, the script reads an orders export and works out which customers are due a follow-up today:
- Day 0: thank-you and how to get started
- Day 3: one useful tip
- Day 7: a check-in question
- Day 14: a review request
It writes the day's emails to followups_today.csv, which you can review and send with any email tool or API.
The input
A simple orders.csv exported from your store:
email,product,order_date,unsubscribed ana@example.com,Starter Kit,2026-11-30,no li@example.com,Pro Plan,2026-11-23,no The code
import csv from datetime import date SEQUENCE = { 0: ("Thanks for your order!", "Here's the fastest way to get started: {tip}"), 3: ("A quick tip for your {product}", "Most people miss this: {tip}"), 7: ("How's it going?", "One question: is your {product} doing what you hoped? Just hit reply."), 14: ("Would you share a quick review?", "If it's been useful, a one-line review helps a lot: {review_link}"), } TIPS = {"default": "start with the quick-start guide in your account."} REVIEW_LINK = "https://example.com/review" def step_for(order_date, today): return SEQUENCE.get((today - order_date).days) def main(path="orders.csv"): today = date.today() with open(path, newline="") as f, open("followups_today.csv", "w", newline="") as out: writer = csv.writer(out) writer.writerow(["email", "subject", "body"]) for row in csv.DictReader(f): if row.get("unsubscribed") == "yes": continue step = step_for(date.fromisoformat(row["order_date"]), today) if not step: continue subject, body = step tip = TIPS.get(row["product"], TIPS["default"]) writer.writerow([ row["email"], subject.format(product=row["product"]), body.format(product=row["product"], tip=tip, review_link=REVIEW_LINK), ]) if __name__ == "__main__": main() How it works
SEQUENCE maps "days since order" to a subject and body template. step_for subtracts the order date from today and looks up that number. If it isn't 0, 3, 7 or 14, there's nothing to send.
TIPS lets you give each product its own tip, with a default fallback. Add entries like "Pro Plan": "connect your first integration in Settings."
Unsubscribed customers are skipped, which matters for staying compliant and respectful.
Running it daily
Schedule it with cron (or Task Scheduler on Windows):
0 8 * * * cd /path/to/project && python followups.py Each morning you get a fresh CSV of exactly who to email.
Next steps
- Send directly through your email provider's API instead of writing a CSV.
- Pull orders straight from your store's API instead of a manual export.
- Route day 7 replies to a shared inbox and tag them ("stuck on setup", "wants feature X"). That's your product roadmap, written by customers.
- Add a "refunded" column and skip those rows too.
Start with day 0 and day 7. They do most of the work.
Want help wiring a follow-up system into your store or SaaS? https://ai-automation-entrepreneur.vercel.app/
