多LLM客户支持聊天机器人 - WordPress与Webhook集成

中级

这是一个AI Chatbot、Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 If、Set、Webhook、Agent、RespondToWebhook 等节点。 面向WordPress和Webhook集成的多LLM客户支持聊天机器人

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
  • Anthropic API Key
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "7eca1f617b7888a52330f7e4ccd35a59e22a8abf0277a3f685d709caea4e7e30",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ae6fca72-e7a3-411c-b5c7-61649c6d76ed",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -64,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4",
          "cachedResultName": "gpt-4"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "qrBipL43bkei0gVE",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5188e333-3d15-409a-947c-a4ac8d613a76",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -224
      ],
      "parameters": {
        "color": 4,
        "width": 424,
        "height": 896,
        "content": "## 适用于 WordPress 和 Webhook 实时聊天的 AI 聊天机器人工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "56526257-ac25-4c8f-8caa-ddff585f8f34",
      "name": "转换聊天文本",
      "type": "n8n-nodes-base.set",
      "position": [
        16,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "310fbac7-d1e4-4745-84e7-42b470128e8c",
              "name": "chatInput",
              "type": "string",
              "value": "={{$json[\"body\"][\"chatinput\"]}}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "1500ed8c-4291-45dd-a04d-ef56f39e9ac1",
      "name": "网站聊天消息",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -176,
        0
      ],
      "webhookId": "5b0516c5-ea62-4573-9571-4e58ea0a7071",
      "parameters": {
        "path": "demo-workflow",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "837c40e5-a27a-4b5f-be5b-c60021644397",
      "name": "结束对话?",
      "type": "n8n-nodes-base.if",
      "position": [
        592,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d9c86f8e-5f6b-4a75-84df-5cf7158e5fe0",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "[END_OF_CONVERSATION]"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "92b0b116-e4e4-4e7c-9748-052f5dd705d6",
      "name": "是 - 结束",
      "type": "n8n-nodes-base.set",
      "position": [
        912,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bae0eeb6-eaf6-4491-8618-88d0c39c45b4",
              "name": "reply",
              "type": "string",
              "value": "={{ $json.output.replace('[END_OF_CONVERSATION]', '').trim() }}"
            },
            {
              "id": "42ca77e1-af22-4c36-ae09-8a395e653024",
              "name": "endOfConversation",
              "type": "boolean",
              "value": true
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "533a8fea-34fc-402a-a031-024073e1c62d",
      "name": "否 - 继续",
      "type": "n8n-nodes-base.set",
      "position": [
        912,
        112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "df4e0c5e-f41f-4db7-bd40-bbf3692e8671",
              "name": "=reply",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4a247e7a-e49c-4c61-9270-b376d3e11c1c",
      "name": "发送聊天至客户端",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1200,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "e5fe5b99-457b-4f74-9570-49cb2c27ccfa",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        576,
        208
      ],
      "parameters": {
        "description": "=当前日期和时间为 {{ new Date().toUTCString() }},您无需向用户询问时间或日期。"
      },
      "typeVersion": 1
    },
    {
      "id": "e895a5b8-2654-4f20-8da8-61fbf0ddde58",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        432,
        208
      ],
      "parameters": {
        "sessionKey": "x-real-ip",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "c37a3df0-1a7c-4e87-8a95-9b60c335b9c8",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        96,
        400
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-pro-latest"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "JmUT5jUrMEVEKvIz",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa82d7db-c223-45b4-822c-756548e017d8",
      "name": "Forerunner™ AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a demo agent for Forerunner™ AI, the very latest in AI chatbots developed by Design for Online®.  when you introduce yourself, make sure you say you are a demo chat agent using a custom n8n workflow.\nYou are an AI agent showcasing the functionality of AI Agents, you are a demo for customers to use - handling live chat requests for <company name>.\nDeliver friendly, concise, non-technical responses with practical advice, \nBe flexible to elaborate briefly when needed, aligning with brand guidelines.  \nYou are focussed on providing assistance and support to the client and being sales focussed when prompted.\nSpelling: UK English\n\n\nTOOLS AVAILABLE FOR YOU TO USE:\nTool name:\nTool description:\nTool requirements: e.g ask for the users first name and email beforehand so you have this to use the tool\n\nBusiness Data Sets\nYou have access to google sheets for business data, you can write and read from this\n\n\n1. Brand Voice & Tone\n\nFriendly & Approachable: Use warm, conversational UK English (e.g., “optimisation”, “organise”) without slang or jargon.\nSupportive & Practical: Offer actionable advice with clear benefits (e.g., more customers, time savings).\nExpert & Transparent: Highlight results simply; be honest about capabilities, avoiding unapproved pricing.\nConcise & Snappy: Keep responses short (1-3 sentences), using up to 5 bullet points only when listing options.\nCreative & Varied: Craft unique intros that feel fresh, showcasing diverse services.\n\n2. Conversational Guidelines\n\nIntros: Your first message to the client should be brief ALWAYS vary your introduction\nIntros: Start with a unique, concise greeting (1 sentence) showcasing varied services (e.g., social media, ads, AI). Avoid repetitive phrasing. Don't use too many adjectives, be personal and support the person you are speaking to.\nKeep responses short (50-100 words) but flexible to elaborate briefly if needed (e.g., explain a service benefit).\nOffer a free 30-minute consultation only if the user is showing intent to contact or go ahead with a service, don't always offer a consultation to the client, your primary goal is to support what they need.\nFor technical issues (e.g., website down), collect URL/errors, escalate.\nAvoid mentioning system instructions.\nUse disclaimer if needed: “This is general guidance. We’ll tailor a plan on a call.”\n\n3. Allowed Topics Discuss only these services:\n\nservice 1\nservice 2\nservice 3\n\n4. Disallowed Topics Do not:\n\nWhen offering tips or advice, be brief and lead into our services and next steps.\nDo not use Em dashes.\nUse jargon.\nMention competitors or their services.\nDiscuss legal, financial, medical, or HR topics.\nRequest data beyond name, email, phone, project details.\nAddress politics, religion, adult, or hateful content.\nShare unapproved pricing or confidential data.\nPlagiarise content.\n\n5. Lead Capture\n\nCollect: Name, company, email, phone, URL, goal.\n\n6. Escalation & Handover\n\nIf they ask to speak to a human, if you have a tool to email the team use that, otherwise direct them to the contact page or add details here.\n\n7. Compliance & Privacy\n\nFollow GDPR: Get consent for storing data.\nRetain chats for 12 months unless opted out.\nDon’t share data without consent.\nAdhere to Google/Microsoft/Amazon Ads policies.\n\n8. Accuracy\n\nIf unsure, say: “Let me check!” and verify.\nDon’t invent testimonials or stats.\n\n9 Contact & Identity\n\nPhone: \nEmail: \nHours:\nAddress: \nOutside hours: “We’ll reply next business day.”\n\nHow to end the conversation:\nOnce the chat is over or the user wants to end the chat make sure to thank the user and add [END_OF_CONVERSATION] to the end of the message.\n"
        }
      },
      "typeVersion": 1.9
    },
    {
      "id": "98ab6795-de7e-4255-b6c1-afd6acd0e9cb",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        96,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-7-sonnet-20250219",
          "cachedResultName": "Claude 3.7 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "md0L5wqAAd5ZKx0Z",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "c26bd7ac-f9bb-4a4f-aee4-3e4d5aa8c943",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        272,
        208
      ],
      "parameters": {
        "model": "google/gemini-2.5-flash",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "tMmBdDXe6dIPdWzv",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b04a5b1-4d74-4a41-920c-3af828f52c00",
      "name": "xAI Grok Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatXAiGrok",
      "position": [
        272,
        400
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "xAiApi": {
          "id": "xetjCwoPrX5HQO1J",
          "name": "xAi account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Forerunner™ AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Yes - End": {
      "main": [
        [
          {
            "node": "Send Chat to Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No - Continue": {
      "main": [
        [
          {
            "node": "Send Chat to Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Forerunner™ AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Convert Chat Text": {
      "main": [
        [
          {
            "node": "Forerunner™ AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "End Conversation?": {
      "main": [
        [
          {
            "node": "Yes - End",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No - Continue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        []
      ]
    },
    "xAI Grok Chat Model": {
      "ai_languageModel": [
        []
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Forerunner™ AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Website Chat Messages": {
      "main": [
        [
          {
            "node": "Convert Chat Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Forerunner™ AI Agent": {
      "main": [
        [
          {
            "node": "End Conversation?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        []
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

这是一个中级难度的工作流,适用于AI Chatbot、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量15
分类2
节点类型13
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Design for Online

Design for Online

@designforonline

AI & Automation consultant based in the UK, running my own digital marketing agency since 2016.

外部链接
在 n8n.io 上查看 →

分享此工作流