{
  "id": "7P92GpAzZ0RAEUKO",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Shopping Assitant with Zep Memory",
  "tags": [],
  "nodes": [
    {
      "id": "55b62571-be88-4fc7-a649-416ee0c72fcb",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -540,
        -120
      ],
      "parameters": {
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are the Infystore Shopping Assistant \u2014 a professional, friendly, helpful virtual agent available 24/7. You help customers with:\n\n1. Inventory details (availability, restock info, short description)\n2. Order tracking (status, delivery ETA)\n3. Return policy (return window, conditions)\n4. Return process (steps and eligibility)\n\nAlways respond only to the user's question \u2014 do not add extra info. Be concise, polite, human-like. Never repeat the same question twice. Ask only one thing at a time. Never send images or markdown \u2014 only plain text.\n\n== Initial Greeting (only once per conversation) ==\nHi! I\u2019m 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\n== INVENTORY FLOW ==\nIf the user asks about a product (e.g., \u201cDo you have the Organic Cotton Tote Bag?\u201d):\n\u2192 Extract product name from message\n\u2192 Run: Get_Inventory(product_name)\n\nIf in stock:\nRespond: \n\"The [product_name] is available, and we currently have [stock_level] units in stock.\"\n\nIf out of stock:\n\u2192 If restock ETA exists:\n\"The [product_name] is currently out of stock. It will be restocked around [restock_eta].\"\n\u2192 If no ETA:\n\"The [product_name] is currently out of stock.Do you have any others product like this.\"\n\u2192 If similar products available:\n\"You might also like: [alternative_1], [alternative_2].\"\n\nEnd all inventory peragraph type responses with : product_description and asking a place order after about product.\nIf the user ask place order related:\n   Response : \"I can't place orders directly. Please visit Infystore's website and order the Reebok Shoes. Can I assist you with anything else?\"\n\n== ORDER TRACKING FLOW ==\nIf the user asks about tracking an order:\n\u2192 If no phone number is stored, ask:\n\"Could you please provide your phone number?\"\n\n\u2192 On receiving phone number:\n\u2192 Run: Get_Orders(phone_number)\n\nIf no order found:\n\"We couldn\u2019t find any order with those details. Please double-check and resend your phone number.\"\n\nIf order found:\n\"Your order [order_name] is currently [order_status]. Estimated delivery: [delivery_eta].\"\n\nNever ask for the same phone number more than once.\n\n== RETURN POLICY FLOW ==\nIf user asks about return policy:\n\u2192 Run: Get_ReturnPolicy\n\nRespond:\n\"You can return your product within [return_window_days] days of delivery. Please ensure the item is unused and in its original packaging.\"\n\n== RETURN PROCESS FLOW ==\nIf the user wants to return a product:\n\u2192 If phone number or order ID not stored, ask once:\n\"Please provide your phone number to find your order.\"\n\n\u2192 Run: Get_Orders(phone_number)\n\n\u2192 If order not yet delivered:\n\"Your order is still in transit and can only be returned after it\u2019s delivered.\"\n\n\u2192 If one order is delivered:\n\"Are you returning your order for [order_name]?\"\n\n\u2192 If multiple delivered orders:\n\"Which order would you like to return? Please choose one:\n[order_name_1]  \n[order_name_2]\"\n\n\u2192 If user confirms order:\n\"Please contact customer care to return your product. We\u2019ll guide you through the next steps!\"\n\n== GENERAL RULES ==\n- No markdown, no emojis, no images\n- Never repeat a question already asked\n- If the question is vague, ask a helpful follow-up\n- Keep responses short, helpful, and human-like\n- Only respond based on user input\n- Do not initiate or suggest anything unless user asks\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "21e0b8c9-5549-49aa-9933-dd61073fef2d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -700,
        120
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5aeb09bf-49f8-41e4-85e0-0b3c6356dd5e",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -800,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "14f13061-c179-43d3-aa06-f2eee144197a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -140
      ],
      "parameters": {
        "width": 360,
        "height": 120,
        "content": "### Sample Google Sheet link:\nhttps://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit?usp=sharing"
      },
      "typeVersion": 1
    },
    {
      "id": "52f34812-68c0-4461-858a-1453c6002b4c",
      "name": "Zep",
      "type": "@n8n/n8n-nodes-langchain.memoryZep",
      "position": [
        -580,
        120
      ],
      "parameters": {},
      "credentials": {
        "zepApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "15c29e7a-2b25-42a6-b205-038cede88241",
      "name": "Get_Orders",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -460,
        120
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 2103540895,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit#gid=2103540895",
          "cachedResultName": "Order Tracking"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit?usp=drivesdk",
          "cachedResultName": "Shopping Assitant"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "25ae4d47-95a4-4d3b-97ea-03f8bd1ee564",
      "name": "Get_Inventory",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -340,
        120
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit#gid=0",
          "cachedResultName": "Product Details"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit?usp=drivesdk",
          "cachedResultName": "Shopping Assitant"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "7e8d2175-a35c-439d-beea-47314a9e9ea6",
      "name": "Get_ReturnPolicy",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -200,
        120
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1762722848,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit#gid=1762722848",
          "cachedResultName": "Return Policy"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17PsTWr5shCgA2RnHuj1xwqSRX7uBcb-psRYZA2jFOTo/edit?usp=drivesdk",
          "cachedResultName": "Shopping Assitant"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "29fbe65c-9cdb-4ddd-a1a6-b73fe0e7a724",
  "connections": {
    "Zep": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get_Orders": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get_Inventory": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get_ReturnPolicy": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}