AutomationFlowsGeneral › AI-Powered Website Live Chat with OpenAI

AI-Powered Website Live Chat with OpenAI

Original n8n title: Website Live Chat AI

Website Live Chat AI. Uses openAi. Webhook trigger; 4 nodes.

Webhook trigger★★☆☆☆ complexityAI-powered4 nodesOpenAI
General Trigger: Webhook Nodes: 4 Complexity: ★★☆☆☆ AI nodes: yes Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Website Live Chat AI",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "live-chat",
        "responseMode": "responseNode",
        "options": {
          "allowedOrigins": "*"
        }
      },
      "id": "d4e5f6a7-4444-4000-8000-000000000001",
      "name": "Chat Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "set-msg",
              "name": "userMessage",
              "value": "={{ $json.body.message }}",
              "type": "string"
            },
            {
              "id": "set-session",
              "name": "sessionId",
              "value": "={{ $json.body.sessionId || 'anonymous-' + Date.now() }}",
              "type": "string"
            },
            {
              "id": "set-page",
              "name": "currentPage",
              "value": "={{ $json.body.pageUrl || 'unknown' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "d4e5f6a7-4444-4000-8000-000000000002",
      "name": "Parse Chat Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a live chat support agent for a website. Be helpful, professional, and concise. The user is currently on page: {{ $json.currentPage }}. If you cannot answer a question, offer to connect them with a human agent. Format responses in plain text suitable for a chat widget. Keep responses under 200 words."
            },
            {
              "role": "user",
              "content": "={{ $json.userMessage }}"
            }
          ]
        },
        "options": {
          "temperature": 0.6,
          "maxTokens": 500
        }
      },
      "id": "d4e5f6a7-4444-4000-8000-000000000003",
      "name": "OpenAI Chat Response",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.6,
      "position": [
        680,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ reply: $json.message.content, sessionId: $('Parse Chat Input').item.json.sessionId, timestamp: new Date().toISOString() }) }}",
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Access-Control-Allow-Origin",
                "value": "*"
              },
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        }
      },
      "id": "d4e5f6a7-4444-4000-8000-000000000004",
      "name": "Respond to Chat",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "Chat Webhook": {
      "main": [
        [
          {
            "node": "Parse Chat Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Chat Input": {
      "main": [
        [
          {
            "node": "OpenAI Chat Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Response": {
      "main": [
        [
          {
            "node": "Respond to Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Website Live Chat AI. Uses openAi. Webhook trigger; 4 nodes.

Source: https://github.com/mlnjsh/n8n-workflows-mega/blob/main/workflows/ai-chatbots/04-website-live-chat-ai.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Text Automations Using Apple Shortcuts. Uses stickyNote, respondToWebhook, openAi. Webhook trigger; 10 nodes.

OpenAI
General

The Recap AI - Lovable Calorie App Backend. Uses openAi, chainLlm, lmChatOpenAi, outputParserStructured. Webhook trigger; 8 nodes.

OpenAI, Chain Llm, OpenAI Chat +2
General

Main: Submit Assignment. Uses readBinaryFile, httpRequest, openAi. Webhook trigger; 22 nodes.

Read Binary File, HTTP Request, OpenAI
General

Contact-Us. Uses emailSend, httpRequest, nocoDb, openAi. Webhook trigger; 7 nodes.

Email Send, HTTP Request, Noco Db +1
General

PDF Q&A System with Pinecone RAG. Uses openAi, httpRequest. Webhook trigger; 7 nodes.

OpenAI, HTTP Request