{
  "name": "E-commerce Support Chatbot (Airtable)",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are the Shopping assistant for Forgent Store.\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 Forgent Store - 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": "7f12e049-0cdf-4ddb-a27a-84cc14de0166",
      "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": "1e245512-7a8e-49c9-a935-752daafc5d5c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "l3MTTeszbGiF6hd0",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management"
        },
        "table": {
          "__rl": true,
          "value": "tblC1o0C7Qjl87uhN",
          "mode": "list",
          "cachedResultName": "Inventory"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        60,
        -220
      ],
      "id": "79128894-488c-463c-ac8c-695a0f21c8f3",
      "name": "Get_Inventory",
      "credentials": {
        "airtableTokenApi": {
          "id": "IHgJiuveAfFzvgv9",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management"
        },
        "table": {
          "__rl": true,
          "value": "tblyzQVL7WQ5gO2hH",
          "mode": "list",
          "cachedResultName": "Order Log"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        180,
        -220
      ],
      "id": "a0b245cf-af88-44a1-8eb4-19e305202d76",
      "name": "Get_Orders",
      "credentials": {
        "airtableTokenApi": {
          "id": "IHgJiuveAfFzvgv9",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "value": "appQfVnqkdIPKfxr8",
          "mode": "list",
          "cachedResultName": "Marketing Campaign Management"
        },
        "table": {
          "__rl": true,
          "value": "tbl7u70gbJ6l9M2zp",
          "mode": "list",
          "cachedResultName": "Return policy"
        },
        "id": "=",
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        300,
        -220
      ],
      "id": "689335a4-7a72-4a08-9339-e698ca3d2b58",
      "name": "Get_ReturnPolicy",
      "credentials": {
        "airtableTokenApi": {
          "id": "IHgJiuveAfFzvgv9",
          "name": "Airtable account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -260,
        -440
      ],
      "id": "54b2cd6b-8484-4d7f-b863-95bf6064c557",
      "name": "When chat message received",
      "webhookId": "72e19315-8164-4a1c-9832-4d401b1ea9e0"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.sessionId }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -60,
        -220
      ],
      "id": "230fa924-db41-4427-9952-82bfec26f6f1",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "content": "### Data Setup\nCreate an Airtable base with these tables/fields, then select it in the Airtable nodes:\n- **Marketing Campaign Management → Inventory**: _(columns as used in the nodes)_\n- **Marketing Campaign Management → Order Log**: _(columns as used in the nodes)_\n- **Marketing Campaign Management → Return policy**: _(columns as used in the nodes)_",
        "height": 140,
        "width": 260
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -480
      ],
      "typeVersion": 1,
      "id": "582502c1-8373-4fd3-920f-431ca003169a",
      "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": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e6d42e6c-9425-4c71-a68e-f9a9057134cd",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "f1c26778ec36097a9722a22c47c5e9c01f00b8862dadd0121ec118026a370fa6"
  },
  "id": "ZS4NDADfLd0gqXEP",
  "tags": []
}