Case study · Node/TS · Google Cloud · Customer.io

Customer.io CRM automations

RoleSoftware engineer
Year2025
StackNode/TS, Google Cloud
PlatformCustomer.io, Shopify, Recharge

An event-driven pipeline behind every email, reminder and profile update for a subscription brand.

The brand runs its customer messaging in Customer.io: order updates, pickup and replenishment reminders, referral and influencer emails, and subscription nudges. I built the layer that feeds it: dozens of small services that turn what happens in the store, subscriptions, deliveries and the referral program into clean events and profile updates.

Each service does one job and hands off through Pub/Sub. Every call to Customer.io goes through a single rate-limited Cloud Tasks queue, so a busy sale day queues up instead of hitting API limits, and delivery is guaranteed.

To keep costs down, Pub/Sub uses push subscriptions instead of pull. Pub/Sub calls each Cloud Run service only when an event arrives, so services scale to zero between events instead of running all day waiting for messages. The trade-off is Firestore TTL: it deletes expired documents within about 24 hours of the due time, not the moment they expire. For restock reminders that timing is fine, so the saving was worth it.

What I built

Every moment a customer should hear from the brand.

01

Order updates from checkout to doorstep, including pickup, refunds and cancellations.

02

Subscription moments: new, paused and cancelled plans, upcoming charges and payment problems.

03

Referral and creator emails, from a new referral to a payout.

04

A live sync of customer profiles that only sends what changed.

05

Reminders to restock, timed to when a product is likely to run out.

06

Pickup and unused-points reminders, plus transactional emails through a queued sender.

How it worksSimplified
ShopifyStore events
RechargeSubscriptions
ShippingTracking
FirestoreProfile changes
LoyaltyProgram events
Transform servicesOne job each
Rate limit handlingCloud Tasks queues
EventsBehaviour
ProfilesAttributes
SegmentsLookups
EmailsTransactional
Database-driven triggersFirestore → Eventarc

Two flows start in the database itself. When a customer record changes, or a reminder's time-to-live runs out, Firestore emits an event. Eventarc hands it to Pub/Sub, and a small service shapes it for Customer.io. Nothing polls and nothing runs on a timer.

updateTTL deleteFirestoreDocument changeEventarcTriggerPub/SubTopicCloud RunTransformCustomer.ioEvent / profilea field changes, ora reminder expiresno polling,no cron jobretries built inkeeps what mattersthrough therate-limited path
Customer profile syncProfiles that follow the database.Customer.io always shows a customer's latest points, orders and subscription, with no nightly export.
01
A customer record changesAny service that updates a customer writes to one place.
02
The change becomes an eventEventarc picks up the update and hands it to Pub/Sub.
03
Keep only what mattersFields that Customer.io uses are kept. Everything else is ignored.
04
Shape the profile updateThe changes are mapped to Customer.io attributes.
05
Send in turnThe update joins the rate-limited queue on its way to Customer.io.
Restock remindersA reminder timed by the database itself.When an order arrives, the system works out when the customer will run low and reminds them just before.
01
Order deliveredA delivery event arrives from the shipping partner.
02
Work out the dateThe service estimates when each product will run out.
03
Store one reminderOne reminder per customer and product type. A newer order replaces the old one.
04
Expire on timeFirestore TTL removes the reminder once it is due, usually within 24 hours, and that removal becomes an event.
05
Trigger the emailThe event is shaped for Customer.io and starts the reminder email.
Built on Google CloudManaged pieces, so each service stays small.
TriggersEventarcTurns Firestore updates and deletes into events.
MessagingPub/Sub (push)Pushes each event to the service that handles it, so nothing polls or stays awake.
Rate limitsCloud TasksQueues calls to Customer.io so limits are never hit.
SchedulingFirestore TTLDeletes a reminder once it is due, and the delete is the trigger. Runs within 24 hours, not to the minute.
ComputeCloud RunRuns each handler, scaling to zero when quiet.
What this shows
01Rate-limit safeEvery Customer.io call waits its turn in Cloud Tasks, so spikes never drop a message.
02Only what changedThe profile sync skips any update that would not change what Customer.io shows.
03Pay per eventPush subscriptions wake Cloud Run only when an event arrives, so no service idles all day. Firestore TTL replaces a scheduler, trading minute-level timing for a 24-hour window that suits reminders.
04One job eachDozens of small services, so a new event never touches the others.