8
n8n 中文网amn8n.com

使用 Llama-4 和 Google 搜索洞察创建 WhatsApp AI 助手

中级

这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 12 个节点。主要使用 Set, Switch, WhatsApp, Agent, WhatsAppTrigger 等节点。 使用 LLaMA 4 和 Google 搜索洞察创建 WhatsApp AI 助手

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "qnJHaFyEszx8iwZH",
  "meta": {
    "instanceId": "9c8f658dbece48b519a8ad7757c7d7db7a30c5f3fd29c9dc8afae32fe0c7711a",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Llama-4 和 Google 搜索洞察创建 WhatsApp AI 助手",
  "tags": [],
  "nodes": [
    {
      "id": "9e6a8db0-cc1f-44b9-871e-f5f1e1929368",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        0
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=You are Seventeen, a friendly and helpful AI assistant created by Manav.  \nYou speak in casual AAVE (American tone) with a light sarcastic vibe.  \n\nAlternate your greetings (e.g., “yo, what’s poppin’?”, “hey, what’s goin’ on?”) so replies don’t feel repetitive.  \nYou are currently talking to {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}.  \nThe current date and time is {{ $now.toISO() }}.  \n\nAvoid writing “G’” at the start of sentences. Keep responses casual but clear.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7f6ef649-57e5-43ae-bf8f-1646a0663089",
      "name": "Groq聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        576,
        240
      ],
      "parameters": {
        "model": "meta-llama/llama-4-scout-17b-16e-instruct",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "3Evg0USLHEyRNZzx",
          "name": "Groq account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "71626a55-43af-4846-b401-d6ce65d9193c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -512
      ],
      "parameters": {
        "color": 5,
        "width": 192,
        "height": 656,
        "content": "## 节点指南:输入切换"
      },
      "typeVersion": 1
    },
    {
      "id": "c83eb856-3032-436f-9460-4a3540464a01",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -288
      ],
      "parameters": {
        "height": 448,
        "content": "## 执行逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "d26f1349-7997-4454-8a1f-2067ebc33570",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 528,
        "content": "## 认识您的 AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "171ab986-4378-4975-bbee-255bde19c84b",
      "name": "主工作流概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        -576
      ],
      "parameters": {
        "width": 656,
        "height": 1168,
        "content": "## 使用 LLaMA 4 和 Google 搜索的 WhatsApp AI 助手"
      },
      "typeVersion": 1
    },
    {
      "id": "5d89108e-adb6-4b05-80dc-4aeedcd64639",
      "name": "基于输入路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        32,
        -16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "57d9036d-3a48-4c8a-b556-98a588d67842",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.messages[0].image }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fc815250-4b24-4554-8f03-3221eed44682",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.messages[0].text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "60cf0325-bb4b-4e6a-9caa-21dd9c05fb51",
      "name": "Google 搜索",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        912,
        240
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "serpApi": {
          "id": "lJEWi2JA3u32XIG6",
          "name": "SerpAPI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b585b12d-3c7b-4ed5-abb4-ba9ed14f45df",
      "name": "准备文本提示",
      "type": "n8n-nodes-base.set",
      "position": [
        304,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "707e792c-1a14-4291-b9bc-e37a740eb5b7",
              "name": "text",
              "type": "string",
              "value": "={{ $json.messages[0].text.body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1a3a3c4d-a403-44b6-bb84-d62ddb4d1208",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        752,
        240
      ],
      "parameters": {
        "sessionKey": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "0c9fbba5-ef00-449c-baae-57a9a7628c3b",
      "name": "发送 WhatsApp 回复",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1072,
        0
      ],
      "webhookId": "53c1a722-1692-4bbd-983c-4dd884153d68",
      "parameters": {
        "textBody": "={{ $json.output }}",
        "operation": "send",
        "phoneNumberId": "768049963047541",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "LV22R0NzX9vZLEp9",
          "name": "whatsapp_reply"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "49c92b8b-fd42-4119-97c5-68a424acc72d",
      "name": "WhatsApp 触发器",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -176,
        -16
      ],
      "webhookId": "ec046705-b8f2-4b88-9b98-4fd99975f432",
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "yVPQQ9GPjNKE9nkZ",
          "name": "whatsApp_OAuth_api"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1da5761e-3847-4206-a0dd-bfb831bc00ec",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Search": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Route Based on Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Text Prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Based on Input": {
      "main": [
        [],
        [
          {
            "node": "Prepare Text Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Manav Desai

Manav Desai

@manavdesai17

Exploring AI and automation with n8n. Here to share builds, learn from the community, and create useful workflows together.

外部链接
在 n8n.io 查看

分享此工作流