Automation
The Automation That Saved 30 Hours a Week and Almost Broke the Business
An order-handling workflow that worked perfectly for five weeks, then failed in a way nobody noticed for three days. What I now build before I build the automation.
The brief was straightforward. A small clothing brand was handling customer messages across Instagram DMs, WhatsApp and email, manually, by one person, at all hours. Order status, size questions, exchange requests. Perhaps thirty hours a week of copy-pasting the same six answers and looking things up in an admin panel.
The automation took about a week to build. Classify the incoming message, pull the relevant order, draft a response, send it for anything routine, escalate anything unusual to a human.
It worked. Response times went from hours to under a minute. The owner got their evenings back. For five weeks it was unambiguously the best thing I had built that year.
Then it broke, and the interesting part is not how it broke. It is that nobody noticed for three days.
#What actually happened
A courier changed the wording of one of their status codes. "Out for delivery" became "Out For Delivery - Attempt 1". The parser that mapped courier statuses to customer-facing language did not match it, returned a null, and the response template filled that null with the default fallback string.
Customers asking where their order was received a cheerful message saying their order status was "unknown".
Not an error. Not a crash. No alert, because nothing threw. The workflow ran successfully, the message sent successfully, the dashboard showed green. Every metric I had built was a throughput metric: messages handled, response time, escalation rate. All of them looked excellent. Messages were being handled faster than ever, because "unknown" is a very fast thing to compute.
Three days and a few hundred messages later, the owner forwarded me a screenshot of an increasingly annoyed customer thread.
#The thing I had built was not what I thought
I thought I had built an automation that answered customer questions. What I had actually built was an automation that sent messages, and I had instrumented the sending.
This distinction sounds pedantic until it costs you three days of customer goodwill. Every monitoring surface I had measured the mechanism, not the outcome. The system could fail completely at its actual job while every indicator stayed green, because no indicator was connected to the job.
Measure the outcome, not the mechanism. A green pipeline that produces garbage is worse than a red one, because nobody is looking.
#What I added afterwards
Output assertions, not just error handling. Every generated response now passes through a set of cheap checks before sending. Does it contain a placeholder token that should have been substituted? Does it contain the words "unknown", "null", "undefined", "N/A"? Is it suspiciously short? Does a message about order status actually contain a date or a location? None of these are clever. All of them would have caught this in minute one.
A canary the system cannot fake. A synthetic order flows through the full pipeline every fifteen minutes, with a known expected answer. If the response does not match, that is a real alert. This catches upstream format changes, which are the most common cause of silent failure and the one you cannot anticipate.
Distribution monitoring on outputs. Not just "how many messages" but "what kind". A sudden shift in the mix. More fallback templates, fewer order-status responses, a spike in one category. Is a signal something changed upstream, even if you do not know what. The courier change showed up immediately in the template-usage distribution once I started tracking it.
A human in the sample, permanently. A fixed percentage of auto-sent messages gets queued for a human to glance at, after sending. Not approval, review. Five minutes a day, and it is the only control that catches the failures I did not think to write an assertion for.
Escalation that defaults to escalating. The original logic escalated when it detected something unusual. Now it escalates when it is not confident, which is a different and better default. Unknown status is not unusual; it is a case the system could not handle. Those should always reach a person.
#The bottleneck was never the messages
The part I got wrong at the design stage was the problem definition. The owner's stated problem was "I spend thirty hours a week answering messages." The real problem was "I cannot leave my phone alone, ever."
Those sound identical. They are not. Solving the first one with automation and no oversight loop actually makes the second one worse. Now you cannot leave your phone alone and you are not sure what is being said on your behalf. For those three days the owner had less peace of mind than before, not more, once they realised something had been wrong and they had not known.
What delivered the real outcome was the automation plus the review queue. Five minutes a day of looking at a sample is what turns "a system is sending messages for me" into "a system is sending messages for me and I know it is fine."
#How I scope the next one differently
The second automation for the same business was returns and exchanges. More complex, higher stakes, more ways to be wrong. An incorrectly approved exchange costs real money and an incorrectly refused one costs a customer.
I scoped it almost inversely to the first.
Start with the escalation path, not the happy path. The first thing built was the queue a human sees, with the full context attached: the order, the message, the policy that applies, and a pre-drafted response. At that point the automation automated nothing. It was a very good inbox. It still removed most of the work, because the thirty hours a week were mostly looking things up, not deciding.
Automate the lookup before the decision. This split turned out to be the right seam. Gathering context is deterministic, verifiable, and low-risk to get wrong. The human notices immediately. Deciding is judgement, carries consequences, and fails silently. Automating only the first half captured most of the time saving with almost none of the risk.
Promote cases to full automation one at a time, with evidence. "Exchange for a different size, same product, within the window, item in stock" is a narrow, highly repetitive case with an unambiguous rule. After a few hundred of those had been handled correctly through the queue, that specific case was allowed to go through automatically. Then the next case. Each promotion is a decision backed by a sample of real outcomes, rather than an upfront guess about what the system can handle.
This is slower to reach full automation and much faster to reach useful. The first version was live in two days instead of a week, and it never had a silent-failure incident, because for the first month there was a human on every single output.
Automate the part that is tedious and verifiable. Keep the part that is consequential and ambiguous behind a person until the data says otherwise.
#What I build first now
Before the automation, in this order:
- The output assertion list. Written before any logic, by asking: what would a wrong answer look like? Usually produces five or six checks in twenty minutes.
- The canary. One synthetic case end to end, on a schedule, with a known answer.
- The review sample. A queue, a percentage, and a place for a human to flag something as wrong, which then becomes a new assertion.
- The outcome metric. One number that reflects whether the job is being done correctly, distinct from whether the pipeline is running. For this system, the proportion of threads that ended without a human needing to step in afterwards.
Then the automation.
It adds maybe a day to the build. It is the day that decides whether you find out about a failure from your monitoring or from a screenshot of an angry customer.