flaibo
Code Technical

Small Script: Automation / Utility

Python script to sync our Stripe customer emails to our Mailchimp audience, authenticated via environment-variable API keys

No card required

What this brief specifies

How it runs

A daily cron job on a Hetzner server, unattended.

What it actually has to do

Pull customers created in the last 24 hours from Stripe, upsert them into Mailchimp with tags for plan and signup date, and log every change to a local file.

What it has to survive

API rate limits, network failures, emails already duplicated in Mailchimp, and new customers with no email on file.

What makes this hard

The difficulty in a script this size isn't the API calls, it's that it runs unattended, daily, with nobody watching each execution. That changes what 'edge case' means: a duplicate email already in Mailchimp isn't a one-off annoyance to fix by hand, it's something the upsert logic has to handle correctly every day without erroring out the whole batch. A Stripe customer with no email on file can't be skipped silently either, since the local log file is presumably the only record of what happened later. And because it's pulling a rolling 24-hour window daily, a single missed run from a rate limit or network failure creates a gap the next run won't automatically backfill unless that's been planned for.

FounderConsultantMarketingSmeCorporate

Frequently asked questions

Carrying forward exactly how it runs, what it's supposed to do on each pass, and the specific ways it can fail unattended means the script an AI assistant helps write handles the rolling-window gap and the duplicate-email case from the start, instead of only the happy path. The next unattended daily job that syncs one system into another starts from that same list of what has to survive, not just what should normally happen.

Ready to try this in Flaibo?

Get started free

Your context everywhere