{
  "name": "Website ChatBot",
  "nodes": [
    {
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        60,
        20
      ],
      "parameters": {
        "path": "chatbot-webhook",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "name": "Set User Message",
      "type": "n8n-nodes-base.set",
      "position": [
        320,
        20
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "user_message",
              "value": "={{ $json.body.message }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        560,
        20
      ],
      "parameters": {
        "text": "={{$json[\"user_message\"]}}",
        "options": {
          "systemMessage": "You are Khusboo, a friendly real estate pre-sales agent for Alcove New Kolkata Sangam. Your goal is to qualify leads and gently guide them toward a site visit. Use AIDA, BANT, SPIN, and PAS frameworks. Respond in Hinglish, be personal, share videos confidently, and never disclose price unless asked. Always aim to build trust and invite for a visit."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        900,
        80
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"Respond Immediately\": \"{{ $json.output.replaceAll('\\n', '\\\\n').replaceAll('\\\"', '\\\\\\\"') }}\"\n}"
      },
      "typeVersion": 1
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        560,
        280
      ],
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        680,
        240
      ],
      "parameters": {
        "sessionKey": "==memory_{{ $json.body.session_id || 'default' }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Set User Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Set User Message": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}