Gemini创意写作AI 评分 · 待评分AI 辅助编辑·未发现明显提示词注入风险n8n.io

用 n8n + WOZTELL + Google Gemini 搭建 WhatsApp AI 自动回复

将 WhatsApp inbound 消息通过 webhook 接入 n8n,过滤后提取对话上下文,由 Gemini 生成回复,再经 WOZTELL 发回客户

有一点经验步骤流程提示词
给谁
已有 n8n 实例、WOZTELL WhatsApp 频道和 Gemini API key 的团队
你会得到
客户发来 WhatsApp 文字消息后,系统自动基于近期对话历史生成专业回复并发送
你需要
n8n

硬约束

前置条件:n8n 账号;WOZTELL 账号且已完成 WhatsApp Business API 频道配置与模板审批;Google Gemini API key。费用:WOZTELL 与 Gemini 按各自平台计费。限制:仅处理文字消息(TEXT);若 liveChat 为 true 或事件类型非 inbound 则忽略;历史记录最多读取 100 条,但模板中 maxResults 设为 10。

他们做了什么

作者 krisatwoztell 在 n8n 上发布了一个官方模板,将 WOZTELL WhatsApp Business API 与 Google Gemini 连接。模板通过 Webhook 接收 WOZTELL 的 inbound 消息事件,用 Filter 节点检查是否为文字消息且未处于 liveChat 状态,然后调用 WOZTELL 的 memberAPI 获取近期对话历史,经 Edit Fields 节点格式化为 Customer/Agent 标签的对话块,再送入 AI Agent 节点由 Gemini 生成回复,最后通过 WOZTELL 节点将 TEXT 类型消息发回客户。

效果如何

来源为 n8n 官方模板(author_report),展示完整可导入的工作流 JSON,包含 15 个节点和明确的连线关系。模板说明声称可实现即时自动回复、减少人工处理负担。本站未实测运行效果。

值得知道

1) 来源未提供可下载的独立 workflow JSON 导出文件,用户需通过 n8n 模板市场导入。2) WOZTELL 的 WhatsApp Business API 账号需完成企业验证与消息模板审批后才能收发消息。3) Filter 条件中的 liveChat 字段依赖 Member Metadata 配置,若未正确映射会导致所有消息被忽略。4) Edit Fields 节点中 maxResults 实际为 10,与 sticky note 中「up to 100」描述存在差异。5) AI Agent 的 systemMessage 要求仅输出纯文本,若 Gemini 返回 markdown 或格式符号,可能需要在下游额外处理。6) 凭证类型为 googlePalmApi(历史命名),实际对应 Gemini 模型。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

  • Google Gemini Chat Model 节点:绑定Google Gemini/PaLM API 凭证。
  • Send responses 节点:绑定woztellCredentialApi 凭证。
  • Get conversation history by id1 节点:绑定woztellCredentialApi 凭证。

需要替换的配置

  • 源模板来自 n8n 公开库 #13641(约 15 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。

模板获取日期: 2026-10-24

步骤

  1. 导入模板

    在 n8n 工作流界面通过模板 ID 13641 导入「Build an AI agent for WhatsApp with WOZTELL and Google Gemini」。导入后可见 Webhook、Filter、Get conversation history、Edit Fields、AI Agent、Google Gemini Chat Model、Send responses 等节点。

  2. 配置 WOZTELL Webhook

    激活工作流后,复制 Webhook 节点的 Production URL,粘贴到 WOZTELL 的 inbound webhook 设置中。事件订阅选择 Inbound Messages。在 Member Metadata 字段填入:Member Metadata: liveChat;Member Path: member.botMeta.liveChat。

    搭建指导 · 来源原文。WOZTELL inbound webhook 配置界面

    After activating this workflow, copy the **Production URL** and paste it into your WOZTELL inbound webhook settings.
    
    Check how to configure the webhook [here](https://support.woztell.com/portal/en/kb/articles/web#Create_Webhooks).
    
    Select **Inbound Messages** in the Event Subscriptions.
     
    In the Member Metadata field, fill in the following details:
    Member Metadata: **liveChat**
    Member Path: **member.botMeta.liveChat**
  3. 连接 WOZTELL 凭证并设置历史记录权限

    在 n8n 凭证管理中添加 woztellCredentialApi 类型凭证。需要生成 WOZTELL access token,权限包括:channel:list、channel:getBasicInfo、member:getConversations、bot:sendResponses、member:getDetails。如已有 Channel API token 可复用。Get conversation history 节点默认读取最多 10 条历史消息。

    搭建指导 · 来源原文。WOZTELL 凭证配置与 access token 生成指引

    Reads up to 100 messages for the account to provide context to the AI.
    
    Set up your WOZTELL credentials. To generate the access token, follow the step-by-step guide [here]( https://support.woztell.com/portal/en/kb/articles/access-token#Access_Token_Generation).
    
    Required permissions:
    - channel:list
    - channel:getBasicInfo
    - member:getConversations
    - bot:sendResponses
    - member:getDetails
    ###
    For the WOZTELL Channel API field, follow [this guide](https://support.woztell.com/portal/en/kb/articles/access-token-channels-in-woztell#How_to_Create_an_Access_Token_for_a_Channel_in_WOZTELL) to create a new token. If you have already generated a token, you may reuse it.
  4. 连接 Google Gemini 凭证

    在 n8n 凭证管理中添加 googlePalmApi 类型凭证,填入 Gemini API key。AI Agent 节点通过 Google Gemini Chat Model 子节点调用,默认 maxOutputTokens 为 1000。可按需调整 token 上限或更换为其他支持的模型。

    搭建指导 · 来源原文。Google Gemini 凭证配置节点说明

    Google Gemini Chat Model provides the AI language model used to generate replies.
    
    Connect your Google Gemini API key. Follow the official n8n documentation [here](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatgooglegemini/).
    
    You can adjust token limits or switch to another supported model if needed.
  5. 激活工作流并测试

    激活工作流。向 WOZTELL 绑定的 WhatsApp 号码发送文字消息。若 eventType=inbound、type=text 且 liveChat=false,系统会检索历史对话、格式化后送入 AI Agent,由 Gemini 生成仅含纯文本的回复,再通过 WOZTELL 发回客户。若条件不满足则静默忽略。

可复制提示词

运行提示词 · 来源原文。AI Agent 节点的 systemMessage 字段

这一段是提示词,页面不会在这里插入广告。

You are a Professional Conversation Analyst and Reply Generator Agent. Analyze the provided conversation snippets. Generate a single, concise, and contextually appropriate reply that directly addresses the last [Customer] statement in a professional tone, (Output **ONLY the plain text** of the reply).

如需调整品牌语气,可修改上述 systemMessage;如需限制回复风格,可在 AI Agent 选项中追加规则。

来源

Build an AI agent for WhatsApp with WOZTELL and Google Gemini · krisatwoztell · n8n.io · 2026-02-24

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例