01Context
What this was
BatteryExpert, a battery and vehicle-parts store on WooCommerce, handled most customer questions through Messenger. They needed to reduce repetitive support in English, Macedonian, and Albanian without guessing on compatibility or catalog details. Operators were reading Messenger threads, checking WooCommerce, and replying by hand throughout the day.
02Problem
What was broken
Before
Humans in the loop for every thread: slow at peaks, inconsistent tone, and training-heavy.
What had to change
The workflow needed LLM flexibility for messy customer language and strict code paths for product lookup, duplicate handling, and escalation.
- 01English, Macedonian, Albanian traffic in one funnel
- 02WooCommerce failures (401, timeouts, odd shapes) are normal at scale
- 03Abuse and duplicate webhooks can starve workers
The architecture prioritizes defensive exits, structured model outputs, and observable state.
03Solution
What I built
Messenger is the customer channel. n8n orchestration receives Messenger webhooks, deduplicates events, applies guardrails, and controls when model calls are worth making.
OpenRouter / Gemini 2.5 Flash handles language detection, intent, and structured extraction.
Deterministic routing decides whether the customer needs a direct answer, a follow-up question, SKU-style search, widened search, or human escalation.
WooCommerce REST provides product and order context with normalization and user-safe fallbacks.
04Decisions
Key implementation decisions
- 01
Structured outputs before backend calls
Never search without validated, complete inputs-saves API cost and reduces garbage queries.
- 02
Hybrid AI + code
LLM handles nuance; code enforces business rules, retries, caps, and messaging safety.
- 03
Sliding conversation memory
Last N messages for continuity without unbounded storage growth.
- 04
Ranking layer over raw SKUs
Business heuristics (stock, category fit, tolerances) before natural-language response generation.
05Impact
Operational impact
- Operators focus on edge cases instead of repetitive product matching.
- Faster median response time during peak message volume.
- More consistent customer-facing tone with fewer dead-end loops.
06Results
Results
- ≈60-70% reduction in repetitive manual support handling for the targeted workflow.
- Near-zero downtime design with graceful degradation paths.
- Multilingual coverage without separate manual triage per language.
- Maintainable workflows visible to technical stakeholders-not opaque scripts only.
07Stack
Technology stack
- Orchestration
- n8n (self-hosted), JavaScript code nodes
- AI
- OpenRouter - Gemini 2.5 Flash
- Commerce
- WooCommerce REST API
- Channel
- Messenger webhooks
