AutomationFlowsAI & RAG › Shopping App Classifier - Product Query and Order ID

Shopping App Classifier - Product Query and Order ID

Shopping App Classifier - Product Query and Order ID. Uses chatTrigger, agent, lmChatOllama, memoryBufferWindow. Chat trigger; 13 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered13 nodesChat TriggerAgentOllama ChatMemory Buffer WindowOutput Parser Structured
AI & RAG Trigger: Chat trigger Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Shopping App Classifier - Product Query and Order ID",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -1340,
        3600
      ],
      "id": "chat-1",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "Classify the latest shopping message and extract product query or order ID details. Return structured JSON only."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        -700,
        3600
      ],
      "id": "agent-1",
      "name": "Classify and Extract"
    },
    {
      "parameters": {
        "model": "qwen3:8b",
        "options": {
          "temperature": 0,
          "keepAlive": "30m"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -820,
        3880
      ],
      "id": "model-1",
      "name": "Ollama Chat Model"
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -620,
        3880
      ],
      "id": "memory-1",
      "name": "Conversation Memory"
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"action\": { \"type\": \"string\", \"enum\": [\"product_search\", \"order_track\", \"support_ticket\", \"hang_to_human\"] },\n    \"language\": { \"type\": \"string\", \"enum\": [\"Eng\", \"Th\"] },\n    \"product_name\": { \"type\": [\"string\", \"null\"] },\n    \"search_query\": { \"type\": [\"string\", \"null\"] },\n    \"product_category\": { \"type\": [\"string\", \"null\"] },\n    \"product_attributes\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n    \"order_id\": { \"type\": [\"string\", \"null\"] },\n    \"missing_fields\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n  },\n  \"required\": [\"action\", \"language\", \"product_name\", \"search_query\", \"product_category\", \"product_attributes\", \"order_id\", \"missing_fields\"],\n  \"additionalProperties\": false\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        -320,
        3880
      ],
      "id": "parser-1",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -380,
        3600
      ],
      "id": "set-1",
      "name": "Extract Pure JSON"
    },
    {
      "parameters": {
        "mode": "expression",
        "output": "={{ ['product_search','order_track','support_ticket','hang_to_human'].indexOf($json.action) }}",
        "looseTypeValidation": true
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        -120,
        3600
      ],
      "id": "switch-1",
      "name": "Route by Action"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { action: 'product_search', language: $json.language, product_name: $json.product_name ?? null, search_query: $json.search_query ?? null, product_category: $json.product_category ?? null, product_attributes: Array.isArray($json.product_attributes) ? $json.product_attributes : [], order_id: null, missing_fields: [], status: 'ready' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        3200
      ],
      "id": "ready-1",
      "name": "PRODUCT SEARCH - Ready"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { output: $json.language === 'Th' ? '\u0e01\u0e23\u0e38\u0e13\u0e32\u0e23\u0e30\u0e1a\u0e38\u0e0a\u0e37\u0e48\u0e2d\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32\u0e2b\u0e23\u0e37\u0e2d\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e04\u0e49\u0e19\u0e2b\u0e32' : 'Please provide the product name or details you want to search for.', action: 'product_search', language: $json.language, missing_fields: ['product_query'], status: 'need_input' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        3400
      ],
      "id": "ask-1",
      "name": "Ask for Product Query"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { action: 'order_track', language: $json.language, order_id: $json.order_id, missing_fields: [], status: 'ready' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        3600
      ],
      "id": "ready-2",
      "name": "ORDER TRACK - Ready"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { output: $json.language === 'Th' ? '\u0e01\u0e23\u0e38\u0e13\u0e32\u0e41\u0e08\u0e49\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e0b\u0e37\u0e49\u0e2d\u0e2b\u0e23\u0e37\u0e2d\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e15\u0e34\u0e14\u0e15\u0e32\u0e21\u0e1e\u0e31\u0e2a\u0e14\u0e38' : 'Please provide your order ID or tracking number.', action: 'order_track', language: $json.language, missing_fields: ['order_id'], status: 'need_input' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        500,
        3800
      ],
      "id": "ask-2",
      "name": "Ask for Order ID"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { action: 'support_ticket', language: $json.language, missing_fields: [], status: 'ready' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        160,
        3780
      ],
      "id": "ready-3",
      "name": "SUPPORT TICKET - Ready"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { action: 'hang_to_human', language: $json.language, missing_fields: [], status: 'ready' } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        160,
        3960
      ],
      "id": "ready-4",
      "name": "HUMAN HANDOFF - Ready"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Classify and Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify and Extract": {
      "main": [
        [
          {
            "node": "Extract Pure JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify and Extract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "Classify and Extract",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Classify and Extract",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract Pure JSON": {
      "main": [
        [
          {
            "node": "Route by Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Action": {
      "main": [
        [
          {
            "node": "PRODUCT SEARCH - Ready",
            "type": "main",
            "index": 0
          },
          {
            "node": "Ask for Product Query",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ORDER TRACK - Ready",
            "type": "main",
            "index": 0
          },
          {
            "node": "Ask for Order ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SUPPORT TICKET - Ready",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HUMAN HANDOFF - Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Shopping App Classifier - Product Query and Order ID. Uses chatTrigger, agent, lmChatOllama, memoryBufferWindow. Chat trigger; 13 nodes.

Source: https://github.com/mobizmad/n8n-workflow-templates/blob/main/shopping/shopping-app-classifier-product-query/workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Becomex v2. Uses chatTrigger, lmChatOllama, agent, toolWorkflow. Chat trigger; 17 nodes.

Chat Trigger, Ollama Chat, Agent +9
AI & RAG

HDW Lead Geländewagen. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Chat trigger; 92 nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +5
AI & RAG

This template attempts to create an AI-powered content assistant for WordPress sites using Mistral AI, enabling article recommendations, content summarization, and contextual Q&A capabilities.

Chat Trigger, Output Parser Structured, Agent +10
AI & RAG

by Varritech Technologies

Chat Trigger, Agent, OpenAI Chat +8
AI & RAG

Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were

Agent, OpenAI Chat, Memory Buffer Window +10