SaaS direct mail from Stripe and product events
SaaS direct mail works as one more channel in your lifecycle code: a customer.subscription.created webhook mails a founder's welcome letter, a usage milestone mails a postcard, and a payment that fails every retry gets a calm letter, each from one request your coding agent can write.
Who builds this
In SaaS the person wiring mail is usually a product engineer or the founder, often working in Claude Code, Codex or Cursor, along with growth engineers who own lifecycle messaging and agencies that run account-based campaigns for B2B sales teams. They hang mail off the events that already send email: Stripe subscription and invoice webhooks, signups, HubSpot deal stages and usage milestones in their own database.
What to mail, and when
| When this happens | Mail this | Price |
|---|---|---|
| Stripe customer.subscription.created, on a customer's first paid plan | A founder's welcome letter with a few setup tips, mailed flat. (8.5x11 letter, Welcome letter) | $0.95 |
| Stripe invoice.payment_failed, once attempt_count shows the retries are used up | A calm billing letter with the plan name and where to update the card. No amounts on it. (8.5x11 letter, Failed payment) | $0.95 |
| Your own event: an account crosses a usage milestone (1,000th invoice sent, first year on the product) | A milestone card with the number and a thank-you from the team. (6x9 postcard) | $0.89 |
| HubSpot deal moves to Closed Won; a workflow webhook reaches your endpoint | A folded onboarding mailer for the champion: setup steps, the CSM's name and the kickoff date. (11x17 folded mailer) | $1.39 |
| Stripe customer.subscription.deleted, plus 30 days | A win-back card listing what shipped since they left. (6x11 postcard) | $0.99 |
Systems to connect
- Stripe. customer.subscription.created, invoice.payment_failed, customer.subscription.deleted and invoice.upcoming. Stripe only has a postal address if you collect one: set billing_address_collection to required in Checkout or ask during onboarding, and keep it on customer.address.
- HubSpot. A workflow's Send a webhook action (Data Hub Professional or Enterprise) posts the properties you pick, with an API key in a request header and an X-HubSpot-Signature. Send it to your endpoint, which maps the company address to Mailr's to.
- Supabase. A Database Webhook on INSERT into your accounts or milestones table calls an Edge Function, and the function calls Mailr.
- Clerk. user.created and other events arrive through Svix; deduplicate on svix-id and verify with Clerk's verifyWebhook helper. Clerk users don't carry a postal address, so mail once you've collected one.
Code: a Stripe welcome letter, milestone cards and HubSpot
// app/api/stripe-webhook/route.js (Next.js). Stripe event: customer.subscription.created.
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
export async function POST(req) {
let event;
try {
event = stripe.webhooks.constructEvent(await req.text(), req.headers.get("stripe-signature"), process.env.STRIPE_WEBHOOK_SECRET);
} catch {
return new Response("Bad signature", { status: 400 });
}
if (event.type !== "customer.subscription.created") return new Response("ignored");
const customer = await stripe.customers.retrieve(event.data.object.customer);
const a = customer.address;
if (a?.country !== "US" || !a.line1 || !customer.name) return new Response("no US address"); // nothing to mail to
const res = await fetch("https://api.mailr.dev/v1/flats", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MAILR_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": `welcome-${customer.id}`, // Stripe retries; this never prints twice
},
body: JSON.stringify({
size: "8.5x11",
template: "tmpl_welcome",
to: { name: customer.name.slice(0, 40), line1: a.line1, line2: a.line2 || undefined, city: a.city, state: a.state, zip: a.postal_code },
merge: {
first_name: customer.name.split(" ")[0].slice(0, 14),
company: (customer.metadata.company || customer.name).slice(0, 24),
founder_name: "Sam",
},
description: `Welcome letter, ${customer.id}`,
}),
});
const flat = await res.json();
if (!res.ok) return new Response(flat.error.message, { status: 500 });
await stripe.customers.update(customer.id, { metadata: { mailr_welcome: flat.id } });
return new Response("ok");
}What it costs
Welcome letters for a month of new paid accounts: 250 8.5x11 letters at $0.95 each is $237.50 on pay as you go, or $230.00 on the Agency plan, printing and postage included. The tmpl_welcome founder letter to each of 250 new paying customers, one per customer.subscription.created. Test pieces are free. All prices.
Questions
Where does a SaaS company get a mailing address?
From the customer. Set billing_address_collection to required in Stripe Checkout, or ask for a shipping address in onboarding with a reason to give one. Mail only the customers who have a US address on file and skip the rest.
Is a failed-payment letter safe to mail without an envelope?
The tmpl_payment_failed letter is written for it: it names the plan and the update link, and leaves amounts and card details off. Keep any edits to that rule, and send it after Stripe's retries, not on the first failure.
Can I run this in CI?
Yes. Test keys (mlr_test_) are free and never print, and a test piece walks from queued to processed_for_delivery in about 8 minutes. A to address whose line1 contains "undeliverable" fails after 30 seconds, so you can test the failure path too.
Does Mailr send webhooks when a letter is delivered?
Not yet. Poll GET /v1/flats/{id} or GET /v1/postcards/{id} for the status and events, or list a batch's pieces with ?batch=bat_….