CASE STUDY 01 / INTERNAL PRODUCT SYSTEM
TECHNICAL CASE STUDY

AI Email
Operations System.

A reusable n8n reference system for the first layer of an inbox: it classifies unread Gmail messages, prepares reviewable drafts when appropriate, applies labels and records each execution.

This is an internal product system and reference implementation — not a report of client outcomes. The case study focuses on the engineering decisions behind configurable AI drafting, validation, testing and operational visibility.

n8n · Gmail · Google Sheets · AI provider variants · Telegram alerts (optional)
TYPE Internal product system
WORKFLOW n8n · v1.0
TRIGGER Unread Gmail Inbox · every minute
OUTPUT Gmail drafts or label-only actions
FINAL CONTROL Human review before any send
PROBLEM & REQUIREMENTS

An inbox is not
one prompt.

An incoming message can be a support issue, a commercial enquiry, a factual question, a newsletter or something that should be set aside. This system separates classification, response preparation and operational action.

The requirement was not to automate sending. It was to make initial handling repeatable while preserving human control over customer-facing communication.

01

Correct routing

Support, Sales, Information, Spam/Newsletter and Other require different permitted actions.

02

Business context

Company details, policies, FAQs and style settings must be editable without rebuilding routes.

03

Safe output

A draft needs a valid subject and body, and must remain reviewable before it is sent.

04

Traceable operation

Successful runs, failures and evaluation results require records beyond an individual execution.

SYSTEM ARCHITECTURE

A controlled routing system
around Gmail.

The v1.0 workflow distinguishes normal message processing, error handling and evaluation rather than treating them as one happy path.

Gmail Trigger Unread Inbox messages · polling every minute
Verify required Gmail labels + inspect Processed Create missing labels · skip already-processed messages
Load configuration + gather thread context Google Sheets configuration · up to six earlier thread messages
Mail Classifier Semantic intent determines the route
SupportAI draft
SalesAI draft
InformationAnswer / no answer
Spam / NewsletterLabel only
OtherLabel only
Schema validation + decision logic → Gmail draft or label → Google Sheets log

Separate error route: normalize failure → write to Logs and Errors sheets → apply Gmail Error label → optional Telegram notification.

Full n8n workflow canvas showing the implemented AI Email Operations System
IMPLEMENTATION · N8N WORKFLOW

Full v1.0 workflow canvas. Sensitive credentials, message content and environment-specific identifiers are excluded from the case study.

ROUTING BEHAVIOUR

Five categories; explicit
permitted actions.

The classifier includes a fallback and automatic parsing correction, while the action for every branch remains explicit.

Support

Support agent uses configuration, knowledge and thread context.

Requires non-empty structured Subject and Body.

Create Gmail draft + Support label + log.

Sales

Sales agent uses configured business and service context.

The same structured subject/body gate prevents malformed drafts.

Create Gmail draft + Sales label + log.

Information

The agent evaluates whether configured company context is sufficient.

CanAnswer is part of the structured output schema.

True: draft + label. False: label only; no answer is created.

Spam / Newsletter

No response agent runs after classification.

Bulk, promotional and unsolicited messages do not need a draft.

Apply label + record decision + log.

Other

Fallback for ambiguous or unclassifiable messages.

No response agent runs after classification.

Apply label and leave it for human review; no draft.

Cropped n8n workflow view showing the classifier and the five routing branches
ROUTING · CLASSIFIER CROP

Classifier and five-branch routing.

HUMAN-IN-THE-LOOP & SAFETY

The workflow prepares communication.
It does not send it.

Every AI-generated reply is a Gmail draft. Staff can inspect, edit or discard it before any external communication happens.

01

Draft, never send

There is no automatic AI-email send step in the workflow.

02

Structured validation

Required response fields are checked before a draft can be created.

03

Answerability gate

Information messages receive a draft only when CanAnswer: true.

04

Bounded context

Agents are instructed not to invent prices, policies, timelines, guarantees or procedures.

05

Input isolation

Inbound email content is handled as user data, not as instructions that can alter the workflow.

06

Restricted advice

Documented agent instructions refuse legal, medical, financial, tax and accounting advice requests.

LOGGING & ERROR HANDLING

Actions are recorded
outside the canvas.

Successful executions append a Google Sheets row with timestamps, status, category, action, received and output email content, workflow and execution identifiers, saved-time estimate and version.

The error route normalizes an error message and node name, writes failure records to Logs and Errors, and applies a Gmail Error label. Telegram notification is present but disabled in v1.0 until configured.

LOGS · GOOGLE SHEETS● AUDIT RECORD
STATUSCATEGORYACTIONVERSION
SuccessSupportDraftv1.0
SuccessInformationLabelv1.0
SuccessSpam / NewsletterLabelv1.0
Dashboard or logging view from the AI Email Operations System using test data
OBSERVABILITY · DASHBOARD & LOGS

Dashboard and operational logging.

The operational workbook includes Dashboard, Analytics, Logs, Errors, Configuration, Evaluations and Evaluation Results. The screenshot uses fabricated test data only; customer email content, identifiers and private configuration are excluded.

TESTING & EVALUATION

Test workflow paths
and AI quality.

The implementation documents a pre-activation test matrix and includes an evaluation sub-workflow that can run against historical test data.

PRE-ACTIVATION MATRIX

Duplicate: skip an already Processed email

Branches: Support, Sales, Information, Spam and Other

Context: reply within an existing thread

Failure: bad payload or simulated error

EVALUATION INPUTS

Expected category, action, answerability and draft fields

Actual classifier category and generated draft fields

Google Sheets evaluation cases

RECORDED RESULTS

Expected vs actual classification

LLM-as-a-judge factual similarity score from 1 to 5

Results appended to Evaluations Results

CONFIGURATION & STACK

Business data is separate
from routing logic.

A five-step setup wizard collects company details, AI behaviour settings, business information, FAQs/knowledge and email signature. It normalizes and stores them in the Configuration sheet for the workflow to load dynamically.

AUTOMATIONn8nMain workflow, setup wizard and evaluation sub-workflow
EMAILGmailTrigger, thread retrieval, drafts and labels
AI VARIANTSFive providersOpenAI · Anthropic · DeepSeek · Google Gemini · Groq
CONFIGURATIONGoogle SheetsBusiness profile, policies, FAQs, AI settings and signature
OBSERVABILITYGoogle SheetsDashboard, analytics, logs, errors and evaluation results
NOTIFICATIONSTelegramOptional error notification; disabled until configured
LIMITATIONS

Boundaries of the v1.0 reference system.

— It creates Gmail drafts; it does not automatically send AI-generated email.

— Draft quality depends on business configuration, provider selection and human review.

— Information questions outside configured knowledge intentionally receive no AI draft.

— Logs include received and generated email content, so deployment needs an appropriate privacy and access policy.

— Telegram alerting is optional and disabled in the inspected v1.0 workflow.

— No retry mechanism is configured in the inspected v1.0 workflow; failures are logged and surfaced.

— Credentials, labels and sheet destinations must be tested before live activation.

— Saved-time values are configured estimates, not measured client impact.

WHAT THIS DEMONSTRATES

Technical delivery beyond
a happy-path demo.

A reference implementation that combines n8n, Gmail, AI and a practical operations layer with routing, validation, test cases, error records and human control.

A packaged commercial version of this reference system is also available as an n8n template: view the Email Automation System.