▶️ Context
- Business: GadgetSpace — an electronics retail chain (phones, laptops, TVs, accessories), 5 offline stores across 4 cities plus an online store.
- Industry: consumer electronics retail, B2C with a small B2B segment (bulk purchases for businesses).
- Previous process: all inquiries (email, WhatsApp, phone calls) landed in a shared inbox and queue. The support team (3 managers) manually read every ticket, determined its category (delivery/payment/warranty/technical issue), and decided how urgently to respond based on personal judgment. There was no formal SLA or prioritization — everything was handled roughly in order of arrival.
▶️ Problem
- No consistent urgency criteria. VIP clients with large corporate orders sometimes waited for a response on par with standard product-availability questions.
- Critical failures (active revenue loss) got lost in the queue. For example, a payment failure on the website or a double charge could sit unaddressed for hours while a manager worked through the queue in order.
- Manual routing wasted time. Every ticket had to be read and understood by a manager before being forwarded to the right owner (sales / tech / billing), adding delay before actual work even began.
- No SLA tracking. There was no way to see how many tickets were overdue or by how much, since deadlines were never formally recorded.
- Escalation of critical cases depended entirely on human attention. If a manager missed a ticket from an angry VIP client, no one automatically notified leadership.
▶️ Solutions
Built an n8n agent that ingests an incoming ticket (email/chat), classifies it via an LLM (OpenAI, gpt-4.1-mini) against a structured schema, and automatically:
- Determines the category (support / sales / tech / billing / spam) using clear criteria.
- Assigns a priority (P1–P4) based on a 3-dimensional analysis (urgency, business impact, VIP context), with dedicated special rules — e.g., a VIP client always gets at least P2, legal complaints always get P1.
- Calculates the SLA deadline (15 min / 2 hr / 24 hr / 48 hr) and stores it in a format ready for later comparison against the current time.
- Assigns an owner (support_lead / sales_lead / tech_lead / finance_lead) by category, with a fallback to support_lead for any ambiguous case.
- Logs the ticket in Google Sheets as the central tracker (status, deadline, reasoning, customer sentiment).
- Monitors SLA breaches via a separate check cycle and escalates through Slack/Email along a 3-tier chain (L0 — reminder to owner → L1 — team lead → L2 — director).
- Generates a thread_link to the original Gmail thread so the responsible person can jump straight into context.
The key architectural decision was using a Structured Output Parser with a strict enum-based schema (rather than free-text LLM output), guaranteeing the result is always valid JSON — ready for direct writing into the tracker and downstream automation, with no manual text parsing required.