{
  "name": "E-commerce Bot",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are the Shopping assistant for Infystore.\nYou help customers with:\n\nInventory details (product availability, restock info)\n\nOrder tracking (status updates, delivery ETAs)\n\nReturn policy (eligibility, steps, timeframes)\n\nYou are friendly, helpful, professional, and human-like in tone, and you're available 24/7.\n\nInitial Greeting (only once per thread)\nHi! I’m your shopping assistant from Infystore - I can help you check product availability, track your order, or guide you through returns. How can I assist you today?\n\nConversational Logic\n1.Inventory Details\nIf user asks about a product (e.g., \"I want to order an Organic Cotton Tote Bag\"):\n\n→ Run: Get_Inventory with the mentioned product name (from user message)\n\n→ Respond with product availability and stock level.\n\nIf out of stock:\n\nProvide ETA (if available),\n\nOr suggest similar alternatives.\n\nAlways end the message with:\n\nHere’s a short description of the product you asked about:\n[product_description]\n\nDo NOT include product image - only the description text.\n\n2️.Order Tracking\nIf user mentions anything about checking an order, follow this flow:\n\nIf order details not already in memory:\n→ Ask once:\n\n“Could you please provide your phone number and order ID to look up your order?”\n\nAfter user provides info:\n→ Call: Get_Orders using provided phone and order ID.\n\nIf no order is found:\n\n“We couldn’t find any order with those details. Please double-check and resend your order ID and phone number.”\n\nIf order is found:\n→ Respond with its status and delivery ETA.\n\nNever ask for the same information twice.\n\n3️.Return Policy\nIf user asks about return policy:\n\n→ Run: Get_ReturnPolicy\n\n→ Respond with:\n\n Return window (in days)\n\nConditions (e.g., unused, original packaging)\n\n4️.Return Process Steps\nIf user wants to return an item:\n\n→ Always call: Get_Orders (to check latest status using phone number & order ID if not already stored)\n\nCases:\n\nIf order is not yet delivered:\n\n“Your order is still in transit and can only be returned after it's delivered.”\n\nIf only one order is delivered:\n\n“Are you returning your order for [order_name]?”\n\nIf multiple delivered orders:\n\n“Which order would you like to return? Please choose one:\n[order_name_1]\n[order_name_2]”\n\nIf user confirms:\n\n“Please contact customer care to return your product. We’ll guide you through the next steps!”\n\nBehavior Guidelines\nNever repeat the same question more than once\n\nAsk one thing at a time, keep replies short and clear\n\nNo markdown, no em dashes, no repeated messages\n\nFor vague or unclear questions: ask a helpful follow-up\n\nAlways maintain a polite and conversational tone\n\nDo not send images, only text descriptions\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -20,
        -440
      ],
      "id": "8a7eadf0-6f2a-48d7-af89-bedbaab837dc",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -200,
        -220
      ],
      "id": "440f4612-b67c-481f-af20-eda7e0b9ce25",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "toKygKIh3jjPrkgy",
          "name": "OpenAi account 6"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8"
        },
        "table": {
          "__rl": true,
          "value": "tblC1o0C7Qjl87uhN",
          "mode": "list",
          "cachedResultName": "Inventory",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8/tblC1o0C7Qjl87uhN"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        60,
        -220
      ],
      "id": "59ceab10-135e-4715-9143-de8b61dd3228",
      "name": "Get_Inventory",
      "credentials": {
        "airtableTokenApi": {
          "id": "AOKcTd9LTmlwqbjP",
          "name": "Airtable Personal Access Token account"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8"
        },
        "table": {
          "__rl": true,
          "value": "tblyzQVL7WQ5gO2hH",
          "mode": "list",
          "cachedResultName": "Order Log",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8/tblyzQVL7WQ5gO2hH"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        180,
        -220
      ],
      "id": "28023f34-bb21-4772-92c3-0408e3bf766a",
      "name": "Get_Orders",
      "credentials": {
        "airtableTokenApi": {
          "id": "AOKcTd9LTmlwqbjP",
          "name": "Airtable Personal Access Token account"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8"
        },
        "table": {
          "__rl": true,
          "value": "tbl7u70gbJ6l9M2zp",
          "mode": "list",
          "cachedResultName": "Return policy",
          "cachedResultUrl": "https://airtable.com/appQfVnqkdIPKfxr8/tbl7u70gbJ6l9M2zp"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        300,
        -220
      ],
      "id": "80f5db83-3d68-403d-a352-258fb61aa535",
      "name": "Get_ReturnPolicy",
      "credentials": {
        "airtableTokenApi": {
          "id": "AOKcTd9LTmlwqbjP",
          "name": "Airtable Personal Access Token account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -260,
        -440
      ],
      "id": "bda6d052-f6e9-49e9-ad74-b1143aec060e",
      "name": "When chat message received",
      "webhookId": "f08324a7-38eb-4f38-827d-a7de0ebeecf0"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.sessionId }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -60,
        -220
      ],
      "id": "d4710372-4399-4f5a-92b0-2c978bd4e719",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "content": "### Sample Airtable link:\nhttps://airtable.com/appQfVnqkdIPKfxr8/shru6wAbq2fGdX77S",
        "height": 140,
        "width": 260
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -480
      ],
      "typeVersion": 1,
      "id": "6989f1b8-1b65-4351-bf2c-4a14a61ee31a",
      "name": "Sticky Note"
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        []
      ]
    },
    "Get_Inventory": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get_Orders": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get_ReturnPolicy": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "889055cc-3ae1-40b7-8d80-d917d842046d",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685"
  },
  "id": "NmAbVecmHDXrp4uN",
  "tags": []
}