8
n8n 中文网amn8n.com

支持机器人

高级

这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Switch, WhatsApp, WhatsAppTrigger 等节点。 通过WhatsApp关键词检测机器人自动化FAQ回复

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "AJtSW2QeCg45qtIh",
  "meta": {
    "instanceId": "922f87b0adfedb3ae09541ddf50e19d9af2c8cfac1d8da5d9cd4cdfe64d30bee",
    "templateCredsSetupCompleted": true
  },
  "name": "支持机器人",
  "tags": [],
  "nodes": [
    {
      "id": "c9cbc315-75dd-4ca4-875c-b9a22fba03d7",
      "name": "传入的 WhatsApp 消息",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -1820,
        120
      ],
      "webhookId": "whatsapp-support-webhook",
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "typeVersion": 1
    },
    {
      "id": "b1a466e1-3d1b-4494-a7d9-0cc2ee1e8202",
      "name": "仅过滤文本消息",
      "type": "n8n-nodes-base.if",
      "position": [
        -1520,
        120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.messages[0].type }}",
              "rightValue": "text"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "298eccc9-0b1a-477f-a153-074972098072",
      "name": "提取消息内容",
      "type": "n8n-nodes-base.set",
      "position": [
        -1260,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "message-text",
              "name": "message_text",
              "type": "string",
              "value": "={{ $json.messages[0].text.body.toLowerCase().trim() }}"
            },
            {
              "id": "sender-phone",
              "name": "sender_phone",
              "type": "string",
              "value": "={{ $json.messages[0].from }}"
            },
            {
              "id": "message-id",
              "name": "message_id",
              "type": "string",
              "value": "={{ $json.messages[0].id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8ac8d5d8-d328-4809-b85e-dd954a1bf307",
      "name": "FAQ 关键词检测",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1020,
        20
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Business Hours",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "hours"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "open"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "close"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "time"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Pricing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "price"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "cost"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "fee"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "money"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Location",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "address"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "location"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "where"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "find"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Contact",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "contact"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "phone"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "email"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "support"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Greeting",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "hello"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "hi"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "hey"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message_text }}",
                    "rightValue": "start"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "2463ba09-2047-4f09-bd95-9fd22e18d6c6",
      "name": "营业时间响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        -200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "🕐 *Business Hours*\n\nMonday - Friday: 9:00 AM - 6:00 PM\nSaturday: 10:00 AM - 4:00 PM\nSunday: Closed\n\nWe're currently {{ new Date().getHours() >= 9 && new Date().getHours() < 18 ? 'OPEN' : 'CLOSED' }} 🟢\n\nNeed immediate help? Type 'contact' for our support details!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a6d20145-ed74-40b4-bb4d-f51c1d9e8d79",
      "name": "定价信息响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "💰 *Our Pricing Plans*\n\n• **Basic Package**: $29/month\n• **Pro Package**: $59/month  \n• **Enterprise**: $99/month\n\n✨ All packages include:\n✅ 24/7 support\n✅ Free setup\n✅ 30-day money-back guarantee\n\nWant a custom quote? Type 'contact' to speak with our team!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "44f08566-7f73-4596-b51e-4b877a18b283",
      "name": "位置信息响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "📍 *Find Our Office*\n\n🏢 **Main Office:**\n123 Business Street\nNew York, NY 10001\nUSA\n\n🚇 Nearest Metro: Times Square\n🅿️ Parking: Available on-site\n\n📱 Want directions? \nGoogle Maps: bit.ly/ouroffice\n\nPlanning a visit? Type 'hours' to check if we're open!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ab28d851-6e0f-482b-8588-ddebddc232d7",
      "name": "联系信息响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "📞 *Contact Information*\n\n🔥 **Priority Support:**\n• Phone: +1 (555) 123-4567\n• Email: support@company.com\n• Live Chat: Available on our website\n\n💬 **Social Media:**\n• Twitter: @company\n• LinkedIn: /company/ourcompany\n\n⚡ **Response Times:**\n• Phone: Immediate\n• Email: Within 2 hours\n• WhatsApp: You're already here! 😊"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d0544cdd-210a-4041-9955-cfb421e80a8b",
      "name": "欢迎菜单响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        220
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "👋 *Welcome to our support!*\n\nI'm here to help you 24/7. What can I assist you with today?\n\n📋 **Quick Menu:**\n• Type 'hours' - Business hours\n• Type 'pricing' - Our packages\n• Type 'location' - Find our office\n• Type 'contact' - Support details\n\n💡 **Pro tip:** Just type what you need, and I'll understand! \n\nExample: \"What are your prices?\" or \"When are you open?\""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e08b7a63-c334-44cb-bf93-f876fe0dfe2e",
      "name": "有用的后备响应",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "response-text",
              "name": "response_text",
              "type": "string",
              "value": "🤔 *I didn't quite understand that...*\n\nNo worries! Here's what I can help you with:\n\n📋 **Available Commands:**\n• 'hours' - Business hours\n• 'pricing' - Package information  \n• 'location' - Office address\n• 'contact' - Support details\n• 'hello' - Show main menu\n\n🔍 **Or simply ask:**\n• \"When are you open?\"\n• \"How much does it cost?\"\n• \"Where are you located?\"\n\n👨‍💼 Need to speak with a human? Type 'contact' for our support team!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5c1d8fdc-df5d-4f7e-97f6-357538b6080d",
      "name": "发送 WhatsApp 回复",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        -420,
        60
      ],
      "webhookId": "fc8d4c8b-8738-4323-8c5f-928ee49a59a5",
      "parameters": {
        "textBody": "={{ $json.response_text }}",
        "operation": "send",
        "phoneNumberId": "REPLACE_WITH_YOUR_PHONE_NUMBER_ID",
        "additionalFields": {
          "previewUrl": false
        },
        "recipientPhoneNumber": "={{ $('Extract Message Content').item.json.sender_phone }}"
      },
      "typeVersion": 1
    },
    {
      "id": "240af2fb-c864-4d2e-883b-57a5a04c9589",
      "name": "处理不支持的消息类型",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        -1260,
        220
      ],
      "webhookId": "8ea475e8-eb38-4fa9-a979-5dc6051c401e",
      "parameters": {
        "textBody": "📝 I can only process text messages at the moment.\n\nPlease send your question as a text message, and I'll be happy to help! 😊\n\nType 'hello' to see what I can help you with.",
        "operation": "send",
        "phoneNumberId": "REPLACE_WITH_YOUR_PHONE_NUMBER_ID",
        "additionalFields": {
          "previewUrl": false
        },
        "recipientPhoneNumber": "={{ $json.messages[0].from }}"
      },
      "typeVersion": 1
    },
    {
      "id": "ce073ef5-4d57-4601-863a-542f489da17e",
      "name": "主工作流说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        -160
      ],
      "parameters": {
        "color": 4,
        "width": 450,
        "height": 1140,
        "content": "# 📱 WhatsApp 客户支持机器人"
      },
      "typeVersion": 1
    },
    {
      "id": "00ea9ba6-8b6e-4535-bc96-3d4900849a36",
      "name": "步骤 1 - 消息接收",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2120,
        -500
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 300,
        "content": "## 步骤 1:消息接收"
      },
      "typeVersion": 1
    },
    {
      "id": "cac18dfa-16c6-4db6-996c-c0823981d15a",
      "name": "步骤 2 - 消息类型过滤",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1740,
        -500
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 300,
        "content": "## 步骤 2:消息类型过滤"
      },
      "typeVersion": 1
    },
    {
      "id": "ffc8672d-1bb8-445b-9a45-6f856a0e532b",
      "name": "步骤 3 - 数据提取",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 240,
        "content": "## 步骤 3:数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "1aedc060-7858-4a40-910e-c779c6cd9363",
      "name": "步骤 4 - 关键词检测",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1020,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 260,
        "content": "## 步骤 4:关键词检测"
      },
      "typeVersion": 1
    },
    {
      "id": "4a0bd23c-4e6d-4bda-b985-86e970107632",
      "name": "步骤 5 - 响应生成",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 350,
        "height": 300,
        "content": "## 步骤 5:响应生成"
      },
      "typeVersion": 1
    },
    {
      "id": "01fe32eb-6a51-4837-9323-9ec4d86579e5",
      "name": "步骤 6 - 消息传递",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 280,
        "content": "## 步骤 6:消息传递"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f1942fbc-84ed-45d8-b613-147cb9c87a05",
  "connections": {
    "FAQ Keyword Detection": {
      "main": [
        [
          {
            "node": "Business Hours Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Pricing Information Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Location Information Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Contact Information Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Welcome Menu Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome Menu Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Business Hours Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Message Content": {
      "main": [
        [
          {
            "node": "FAQ Keyword Detection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Text Messages Only": {
      "main": [
        [
          {
            "node": "Extract Message Content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Unsupported Message Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Helpful Fallback Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Incoming WhatsApp Messages": {
      "main": [
        [
          {
            "node": "Filter Text Messages Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contact Information Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pricing Information Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Location Information Response": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客服机器人, AI 聊天机器人

需要付费吗?

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

工作流信息
难度等级
高级
节点数量19
分类2
节点类型6
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流