Module 21 · business · intermediate
Exercises 21 · Overdue Invoice Chaser
Start from workflow/starter.json (triggers, Stripe fetch, normalization) or your finished lesson workflow.
Exercise 1: Pause when the customer replies
Task: When a customer replies to a reminder, pause that invoice for 5 days and forward the reply to the owner.
Done when: replying "we'll pay Friday" to a reminder pauses chasing (ar/status shows paused_until) and the owner gets the reply.
Hint
Every subject contains the invoice number. A Gmail Trigger on replies (subject:invoice -from:me) can extract it with a regex, but the pause API needs the Stripe invoice id: keep a number → id map in static data (write it in plan.js) or look it up with Stripe GET /v1/invoices/search.
Exercise 2: A Google Sheets source
Task: Support businesses without Stripe: read open invoices from a sheet with columns id, number, customer, email, amount_remaining, currency, due_date, status, pay_url.
Done when: the scheduled run chases invoices from the sheet, and marking a row paid stops the reminders.
Exercise 3: Stripe pagination
Task: Fetch all open invoices, not just the first 100.
Done when: with more than 100 open invoices, open_invoices matches Stripe's count and has_more is false.
Stretch: Slack summary
Post the weekly summary to a Slack channel as well, with the largest overdue invoices as a list.