Title: AI Sales Consultant for a Clothing Store (Telegram + Instagram Direct)

Context: A retail clothing store for men and women. Sales run through Instagram Direct and Telegram, the product catalog lives in a Google Sheet, and delivery is handled by Nova Poshta with full prepayment.

Problem: Every incoming DM is handled manually: find the item in the sheet, check availability and size, quote the price, collect shipping details, then re-type the order into the log. Roughly 10 minutes per inquiry. Outside business hours and on weekends nobody answers at all — that's 192 hours of silence per month, covering exactly the time people scroll their feed most. On top of that comes human error: an outdated price, or an item that's already sold out.

Solution: Six interconnected n8n workflows. Two are channel entry points (Telegram and Instagram Direct), three run as tools for the AI agent (catalog, orders, escalation), and one keeps the vector database in sync in the background. The agent consults customers, suggests sizes, offers alternatives, assembles the order, and hands it to the manager fully prepared.

Без імені.jpg

Instagram Direct.jpg

Clothing.jpg

Delivery.jpg

Handoff.jpg

Sync.jpg

Розмова.jpg

Overall logic:

  1. Consultant — Telegram entry point: bot trigger, a "is this text?" filter, then the AI agent and a reply into the same chat.
  2. Instagram_Direct — Instagram entry point: a single webhook handling both Meta's verification handshake and incoming messages, event parsing, the same AI agent, and a reply via the Instagram Graph API.
  3. Clothing (tool) — semantic search across the catalog in pgvector: returns up to 5 most relevant items, filtered to in-stock only.
  4. Delivery (tool) — receives the assembled order: simultaneously sends the manager a structured Telegram message and writes a row into an n8n Data Table.
  5. Handoff (tool) — escalation: when the agent doesn't know the answer or the situation is off-script, the manager gets a Telegram notification.
  6. Sync — hourly full reload of the catalog from Google Sheets into the vector database.

Key feature: business logic is decoupled from the channel. A channel workflow is responsible only for transport — accept a message, return a reply. Everything that matters — catalog, orders, escalation — lives in three standalone sub-workflows that both channels call as tools. Adding WhatsApp, Viber, or a website widget means one new entry-point workflow wired to the same three tools, with no logic rewritten.

The second property matters more here than speed: the agent physically cannot invent a price or a stock status. The catalog isn't in the prompt — the agent only sees rows returned by the database, and only those matching the "in stock" filter.

Instagram Direct ─┐
                  ├─→ AI Agent ─┬─→ Clothing → pgvector (Supabase)
Telegram ─────────┘  (OpenRouter)├─→ Delivery → Telegram + Data Table
                                 └─→ Handoff  → manager in Telegram

Google Sheets ──(hourly)──→ Sync ──→ pgvector

Process

1. Prompt & Agent Behavior

The system prompt defines the role (a sales consultant with 10 years of experience), the tasks, the format, the tone, and — most importantly — the constraints. The key rules: