CASE STUDY · CONTRACT AUTOMATION

Customer support,
automated.

A premium e-commerce brand with two storefronts was answering every support email by hand. We built an AI pipeline that reads the inbox, sorts every message, clears what is already handled and drafts replies for the team to approve. It runs every day, in production.

Live in production
AI triageReply draftingHuman approvalTwo storefronts
THE CHALLENGE

A busy inbox,
two stores, one team.

Order questions, warranty claims, returns and address changes arrived mixed in with supplier mail, marketing, shop notices and spam. A first version handled sorting on an outside platform, but the brand wanted to own the whole system, and as volume grew, a single long run kept failing halfway through with nothing to show.

The brief: take full control, make it dependable, keep it secure, and go further than sorting, all the way to ready-to-send replies.

HOW IT WORKS

From inbox
to approved reply.

Each cycle runs on a schedule throughout the day. Here is what happens to every email.

  1. 01Security scan

    Every incoming email is checked against 28 known attack patterns across 11 categories before any AI reads it. Anything suspicious is quarantined, and if the inbox cannot be read safely, the run stops rather than guessing.

  2. 02Rule-based pre-filter

    Fast, plain rules handle the obvious cases first: shop system notices, suppliers, marketing, postal updates and payment disputes. This sorts 80 to 90% of email without calling an AI model at all.

  3. 03Triage

    What remains is classified by AI into precise categories per storefront: where is my order, warranty, returns, shipping, out of stock, address change, order changes, chargebacks and general questions, plus product, compatibility and pre-order enquiries.

  4. 04Cleanup

    Threads the team has already answered or attended to are cleared from the review queue, so people only see what still needs them.

  5. 05Fixed-answer order tracking

    "Where is my order?" emails skip the AI entirely. The tracking details come straight from the store and drop into a fixed, approved reply, so there is nothing to guess and nothing to invent.

  6. 06Draft

    For each open case, the system reads the last five messages in the thread, looks up the live order in the store, pulls the matching help article, gauges the customer's mood and urgency, and writes a reply in the brand's own voice.

  7. 07Human review

    Nothing is sent automatically. Every draft lands in the inbox labelled for review, and a person approves, edits or discards it.

  8. 08Accuracy check

    After the team sends a reply, the system compares it with its own draft, word by word, and scores how much was changed. Every result is stored, so accuracy is measured, never assumed.

The full system map: three hourly runs, store lookups, help-content caching and human review before anything is sent.
INSIDE THE LIVE SYSTEM

The inbox, the records,
the real results.

Screenshots from the running pipeline: message sorting in Gmail, draft and accuracy records in BigQuery, and the weekly report.

The support inbox

Processed messages and reply drafts are labelled in Gmail for the team to review.

Sorting before drafting

Business and system messages are filtered out of the customer support queue.

Every draft recorded

BigQuery stores the draft history. Private message content and customer records are obscured.

Draft versus sent reply

Edit distance, percentage changed and review grades are recorded alongside each reconciled reply.

The weekly accuracy report

A dated snapshot of pipeline health and category-level results, including replies that needed substantial rewriting.

UNDER THE HOOD

Engineered for
the real world.

Built to survive failure

  • The work is split into independent stages, each with its own time limit and only the connections it needs.
  • A store outage only affects drafting; sorting keeps running.
  • Stalled processes are shut down cleanly so nothing piles up.

No passwords in plain sight

  • Store access keys moved out of configuration files into the operating system's encrypted credential vault.
  • Keys are injected only at run time and rotated with a single command.

Protected against manipulation

  • Emails are scanned for prompt-injection and data-extraction tricks before the AI sees them.
  • The system fails closed: if it cannot check, it does not proceed.

Fast and economical

  • Labels are applied in two or three batch calls instead of one per email.
  • Help content is cached for 24 hours, so drafting makes no repeat lookups.
  • One query change removed over 200 wasted calls per cycle.

Replies that sound human

  • Tone adapts to the customer: empathy first for frustrated customers, the answer first for urgent ones.
  • Approved and forbidden wording is enforced, drawn from a 705-entry question and answer index traceable to the brand's own documents.

Measured, not assumed

  • Every draft is logged, then matched against what the team actually sent.
  • A weekly accuracy dashboard shows which categories are reliable enough to trust more, and which need work.
EARNING TRUST

Automatic only
once it is proven.

Every reply is graded against what the team actually sent. A type of email can only move to sending on its own after it reaches at least 95% accuracy across more than 100 real emails. Until then, a person approves every single one, and today every reply is still reviewed by the team.

GradeWhat it means
PerfectSent exactly as drafted
Minor editLess than 5% changed
Major edit5 to 50% changed
RewriteMore than half rewritten

Facts and tone are handled differently. Order details, policies and product specifications are locked and never reworded creatively. Only the phrasing around them is allowed to flex to suit the customer.

PhaseWhat it addsStatus
1Store and data foundationsComplete
2Fixed-answer order trackingComplete
3Draft versus sent accuracy trackingComplete
3.5Understanding intent, search by meaningIn progress
4Automatic replies for proven categoriesCollecting data
5Marketplace inbox connectionPlanned
BEYOND THE INBOX

Insight the brand
did not have before.

Weekly issue trends

Every Monday the system reports which problems customers raise most, which ones are rising week on week, and which conversations carry a high risk of escalation, so the brand can fix causes before they turn into emails.

Marketing link checker

After a welcome email went out with a link that worked for nobody, we built a read-only checker that tests every link in the brand's marketing emails and flags broken or unsafe ones.

Packaging feedback review

On request, eight months of customer emails were pulled and sorted to surface every comment about packaging, answered or not, for the product team.

Search by meaning

In progress: help content is being indexed by meaning, not just keywords, so drafts find the right answer even when a customer words the question in an unexpected way.

RESULTS

Before and
after.

MeasureBeforeNow
ScopeSorting only, on an outside platformFull pipeline: security, sorting, cleanup, drafting, measurement
Full cycle timeNot applicableAbout 15 to 20 minutes
Draft backlog42 waiting6 at steady state
Emails needing AI to sortAll of them10 to 20%
Label calls per runOne per email2 to 3 in total
Hours covered8am to 6pm, weekdays6am to 11pm
Access keysPlain text in config filesEncrypted credential vault
Claude AIModel Context ProtocolGmailShopifyGoogle DriveBigQueryPythonDocker
WHAT WE LEARNED

How we
build.

Fix the cause, not the clock

When a run timed out, we fixed the query that wasted the time instead of simply allowing more time.

Split by what can fail

Stages are divided by the services they depend on, so one outage never takes everything down.

People stay in charge

AI does the heavy lifting; a person approves every reply before a customer sees it.

LET’S CONNECT

Have a process
worth automating?

Tell us what takes up your team's time. We will tell you honestly what can be automated.

Start a conversation