How it works

The sales agent in this showcase is a self-hosted n8n workflow (Docker on my VPS) with AI and tool calling. These are screenshots of the real workflow that answers in the chat (the English chat runs a twin of it). All data is sample data for a fictional brand (“Ombú Sofás”).

← Back to the chat

The flow, step by step

  1. The WhatsApp message comes inIn production it arrives through the WhatsApp webhook (Kommo / WhatsApp Cloud API). In this showcase, n8n's public chat plays that role.
  2. GuardrailsBefore any AI spend: a 500-character cap, per-session and global message limits, a daily cap on AI replies, and per-IP rate limiting in nginx.
  3. Intent rulesFixed rules, no AI: a custom size or a request for a sales rep goes straight to the CRM. Everything else continues with the AI agent.
  4. AI agent + catalog toolThe agent queries the live catalog with tool calling (a sub-workflow). Cash price, installments and stock are computed in code, never “made up” by the model. It has per-conversation memory.
  5. Handoff to KommoIt builds the lead in the real Kommo API format (/api/v4/leads/complex): model, fabric, size and the original message. Here it is stored in a table instead of calling Kommo.
  6. Error workflowIf something fails, a separate workflow logs the error with the step and details. In production it would alert via Slack or email, and the conversation never goes unanswered.
Main n8n workflow: inbound message, guardrails, intent rules, AI agent with the catalog tool and Kommo handoff
Main workflow: message → guardrails → intent rules → (a) Kommo handoff or (b) AI agent with memory and the catalog_lookup tool. Tap the image to see it full size. (Screenshot of the Spanish workflow; the English twin has the same structure.)
Catalog sub-workflow: reads the product table and applies the pricing rules
Catalog tool (sub-workflow): reads the product table on every query and applies the business rules (cash −10%, 3/6 interest-free installments, 12 installments +18%). Change a price in the table and the bot answers with it right away. Prices are in Argentine pesos (ARS).
The n8n editor is private (owner login only). This page is a read-only view. Products, prices and stock are sample data.