← Back to work

// case study · 2020

Dunning Engine

Automated accounts receivable escalation system

2020 · Production
PythonEmail AutomationMySQLPerlWorkflow Logic

An end-to-end dunning automation system replacing a manual AR chasing process. Handles multi-step escalation sequences, dynamic email templating, scheduling, and a tamper-evident audit trail.

The problem

Accounts receivable chasing was entirely manual — someone had to track overdue invoices, decide which escalation step to apply, write the email, and log the action. Error-prone, time-consuming, and completely unscalable as the client base grew.

The approach

Built a rules engine that maps invoice age and previous contact history to the next dunning action. Each debtor gets their own escalation state tracked in MySQL. A cron-driven processor runs nightly, evaluates all open invoices, generates the appropriate email from a template system, queues it for delivery, and writes an audit row. No human in the loop for standard cases.

Template system

Templates are stored as plain text with variable placeholders — debtor name, invoice number, amount, due date, days overdue. Each escalation step has its own template with appropriate tone. Business users can edit template text directly without touching code.

Outcome

Reduced manual AR workload by the equivalent of several hours per week. Average days-to-pay improved as consistent follow-up replaced sporadic manual chasing. Audit trail satisfies internal compliance requirements with a complete history of every contact attempt.

Full stack

Python Perl MySQL SMTP Jinja2-style templating Linux/Cron Bash
← All projects Hire me →