{
  "name": "Customer authentication for chat support with OpenAI and Redis session management",
  "nodes": [
    {
      "id": "0c0090f9-c3a6-421d-8c67-92baeded6007",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -580,
        -160
      ]
    },
    {
      "id": "adf71970-7f0c-4394-bdab-b701eaa7173f",
      "name": "LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -240,
        40
      ]
    },
    {
      "id": "56318a6e-3a05-4f6b-9eb5-15ad6144144e",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -120,
        40
      ]
    },
    {
      "id": "6bde1175-7175-4ccd-ac0b-65ecc8c2d7b3",
      "name": "Get Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -400,
        -160
      ]
    },
    {
      "id": "81f53ae3-22b6-48cd-83b9-3c6c1041818c",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        340,
        -120
      ]
    },
    {
      "id": "ade09ef9-b2bc-4cf0-84b5-7121623b4f7b",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        540,
        -120
      ]
    },
    {
      "id": "7ee9de6a-bb37-4adc-87a2-ddb745d17ab7",
      "name": "Get Auth Url Response",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        -120
      ]
    },
    {
      "id": "880f7506-0947-47f1-ba0d-d08d6d18133b",
      "name": "Get Auth URL",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        40,
        40
      ]
    },
    {
      "id": "800be1b0-5bec-4eaf-ac13-e6808b955408",
      "name": "Update Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        1620,
        -120
      ]
    },
    {
      "id": "8b3d4728-2ae2-40dd-98ee-9efb915d06fc",
      "name": "Confirm Login Success",
      "type": "n8n-nodes-base.form",
      "position": [
        1800,
        -120
      ]
    },
    {
      "id": "5cb5797a-7f6c-4855-bcaa-4475ef16ec8d",
      "name": "Customer Support Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -200,
        -160
      ]
    },
    {
      "id": "1b1f96f6-6f70-4b86-9831-0ac31a65dbdc",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -380
      ],
      "parameters": {
        "width": 840,
        "height": 560,
        "content": "## 1. Create a Conversational Agent with Session Access\n[Learn more about AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent)\n\nOur support agent han"
      }
    },
    {
      "id": "b41e156c-a70f-422a-a37a-432e5657a999",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -380
      ],
      "parameters": {
        "width": 720,
        "height": 560,
        "content": "## 2. Generate a Login URL via Tool\n[Learn more about Subworkflow Triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflowtrigger)\n\nThe login URL is a simple redire"
      }
    },
    {
      "id": "bd10ad35-7c72-480f-86fd-e15ee4011688",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -380
      ],
      "parameters": {
        "width": 1020,
        "height": 560,
        "content": "## 3. A Login Form to Link Session to Customer Profile\n[Learn more about the Form Trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.formtrigger)\n\nThis login form is pretty st"
      }
    },
    {
      "id": "f13700b3-69cb-4809-b982-9204c2766948",
      "name": "Get Customer Profile",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        -120
      ]
    },
    {
      "id": "66c28c7e-7ff1-4aac-8fbf-35e8c8105a65",
      "name": "Replace Me!",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        -120
      ]
    },
    {
      "id": "e58f3c0f-c441-4c89-9a19-2c3459733dee",
      "name": "Login Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        1080,
        -120
      ]
    },
    {
      "id": "2f965c47-76e3-4100-8c48-2be4dccece49",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        60
      ],
      "parameters": {
        "width": 200,
        "height": 140,
        "content": "### Replace with Authentication Logic!\nThis could be a query to a PostgreSQL database or otherwise."
      }
    },
    {
      "id": "1d5077eb-4a6b-4bcb-9a85-e525a6c013ab",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1160,
        -820
      ],
      "parameters": {
        "width": 460,
        "height": 1160,
        "content": "## Try It Out!\n### This n8n template demonstrates one approach to customer authentication via chat agents.\n\nUnlike approaches where you have to authenticate users prior to interacting with the agent, "
      }
    }
  ],
  "connections": {
    "LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get Auth Url Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Login Form": {
      "main": [
        [
          {
            "node": "Replace Me!",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session": {
      "main": [
        [
          {
            "node": "Customer Support Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace Me!": {
      "main": [
        [
          {
            "node": "Get Customer Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Auth URL": {
      "ai_tool": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update Session": {
      "main": [
        [
          {
            "node": "Confirm Login Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer Profile": {
      "main": [
        [
          {
            "node": "Update Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Get Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}