n8n AI SEO 内容优化与 SERP 竞品分析工作流
输入 SEO 草稿 → AI 结合历史版本、竞品 SERP 数据与知识库优化 → 结构化 JSON 输出 → Slack 人工审批 → 保存至 Google Sheets
- 给谁
- 需要批量优化 SEO 内容并保留版本历史的营销团队、内容运营或代理机构
- 你会得到
- 将现有草稿转化为结构化的 SEO 优化版本,经 Slack 审批后自动保存到 Sheets,保留版本号与元数据
- 你需要
- n8n · google-sheets · pinecone · serpapi · slack
硬约束
前置条件:n8n 实例;OpenAI API key;Google Sheets OAuth2;SerpAPI key;Slack Bot Token(chat:write 权限);Pinecone API key 与已有索引;预创建包含 content_versions 工作表的 Google Sheet。费用:各 API 按实际调用计费,OpenAI 使用 gpt-4o-mini。限制:模板中的 [Your Google Sheet ID]、[Your Slack Channel ID] 及 Pinecone 索引名需替换为实际值;Save Approved Draft to Sheet 节点存在字段映射错位(tone←improvements、topic←title、context_used←content_id),复现前需核对列名;Check Human Approval Status 节点缺少拒绝分支;AI Agent 后并行触发 Sheets 保存与 Slack 审批,存在未审批即保存风险;本站未实测运行。
他们做了什么
模板作者 rahul08 在 n8n 上构建了一个工作流模板:通过 Chat Trigger 接收内容优化请求,由 AI Agent(GPT-4o-mini)调用 Google Sheets、Pinecone 向量库和 SerpAPI 三类工具获取上下文与竞品数据,生成结构化 JSON 输出,再经 Slack 人工审批后保存到 Sheets 并发送成功通知。模板包含完整的节点连线、JSON schema 示例和 14 字段的 Sheets 映射。
效果如何
来源未提供该模板的实际运行结果或用户反馈数据;n8n.io 显示 308 次查看(author_report)。
值得知道
1. 模板中的 Google Sheet ID、Slack Channel ID 和 Pinecone 索引名均为占位符,必须替换。2. Pinecone 节点缓存的索引名为 whatsappchatbot,明显是示例残留,需改为实际索引。3. 系统提示词署名 built by Vivek Patidar,但模板作者为 rahul08,提示词可能复用自其他项目。4. 版本号递增逻辑在 system message 中描述为 VER-00X 格式,但节点未展示完整实现,需用户自行验证 Sheets 中的版本控制公式。5. Save Approved Draft to Sheet 存在字段映射错位:tone←improvements、topic←title、context_used←content_id。6. Check Human Approval Status 仅配置批准分支,拒绝后无处理路径。7. AI Agent 后并行触发 Sheets 保存与 Slack 审批,存在未审批即保存风险。8. 本站未实测该工作流,reproduction=not_tested。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- 导入后按各需鉴权节点绑定你自己的凭证;本附件不含原作者密钥。
需要替换的配置
- 源模板来自 n8n 公开库 #10832(约 20 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
配置触发器与输入参数
在 n8n 中导入模板后,配置 Chat Trigger 节点作为入口。打开 Set Input Parameters(Edit Fields)节点,设置测试用的 topic(主题)、content(内容 ID)、intent(意图,如 optimize)和 parameter(可选的优化目标与关键词)。保存后可通过 Chat 界面或手动执行触发工作流。
连接数据源与凭证
在 n8n 凭证管理器中配置以下 5 项凭证:OpenAI API、Google Sheets OAuth2、SerpAPI、Slack OAuth、Pinecone API。然后更新各节点参数:Retrieve Context from Google Sheets 节点替换 documentId 为你的 Sheet ID 并确认工作表名为 content_versions;Query Company Knowledge Base 节点确认 pineconeIndex 指向你的索引(模板缓存显示为 whatsappchatbot,需替换),并检查 OpenAI Embeddings for Vector Search 节点已连接且 dimensions=512;SerpAPI Competitor Analysis 保持默认或按需调整。Short-Term Memory 节点使用自定义 sessionKey 维持对话连续性。
配置 AI 优化代理与结构化输出
AI Content Optimization Agent 节点已连接 GPT-4o-mini 模型、Sheets 工具、Pinecone 工具、SerpAPI 工具、Short-Term Memory 和 Structured Output Parser。需要检查两项提示词配置:User Prompt(text 字段)接收当前输入变量并调用 Sheets 内容;System Message(options.systemMessage)定义优化规则、SERP 数据使用方式和版本逻辑。Enforce JSON Output Structure 节点提供输出 schema 示例,包含 optimized_draft(title, meta_description, sections, word_count, keywords_used, improvements)和 metadata(content_id, version_no, version_id, timestamp)。如需调整字段,修改该节点的 jsonSchemaExample。
运行提示词 · 来源原文。AI Content Optimization Agent 节点的 text 字段(User Prompt)
=Topic: {{ $json.topic }} Intent: {{ $json.intent }} Content ID: {{ $json.content }} Optimization Goal: {{ $json.parameter.goal || 'Improve SEO, tone, and readability' }} Focus Keywords: {{ $json.parameter.focus_keywords ? $json.parameter.focus_keywords.join(', ') : 'N/A' }} Context (from Sheets or memory): {{ $json.context || $memory || 'No context found' }} Using the content retrieved from Sheets, optimize the article to follow the tone and outline guidelines. Ensure it aligns with the optimization goal while maintaining factual accuracy and original intent. Return the optimized article in structured JSON format.运行提示词 · 来源原文。AI Content Optimization Agent 节点的 options.systemMessage 字段
=You are "Optimization Agent", a senior content optimizer AI inside an n8n automation system built by Vivek Patidar. Your job: Improve the provided draft WITHOUT rewriting it from scratch by using: 1. The existing draft text from the workflow input 2. Historical versions from Google Sheets ("content_versions") 3. SERP intelligence from SerpAPI (competitors, headings, snippets, PAA, related searches) 4. Brief or metadata passed from the previous stage You must produce a refined, SEO-optimized, well-structured and factually consistent version of the draft. -------------------------------- 📎 HOW TO USE SERP DATA -------------------------------- You receive SERP data via upstream tools (SerpAPI). Use it to: - Identify missing topical sections compared to competitors. - Enhance keyword coverage and semantic depth. - Improve H2/H3 section clarity and completeness. - Strengthen meta description using competitor insight. - Suggest improvements based on PAA questions (People Also Ask). - Add missing angles/topics found across rankings. - Improve EEAT signals (expertise, trustworthiness) when relevant. - DO NOT output any raw SERP JSON. SERP data should influence optimization decisions, but never override the original meaning of the draft. -------------------------------- 📝 OPTIMIZATION RULES -------------------------------- 1. **Never rewrite from scratch.** Always keep the core meaning and structure. 2. **Preserve tone** from the original draft or brief. 3. **Preserve factual accuracy** – no hallucinations. 4. **Only improve**, refine, reorganize, expand, clarify, or SEO-enhance. 5. **Use keywords naturally**, avoid keyword stuffing. 6. **If brief or previous versions exist**, align with them. 7. **If SERP data suggests missed content**, incorporate it softly into relevant sections. 8. **If the draft is messy**, reorganize into sections while preserving original paragraphs as much as possible. 9. **Never expose intermediate reasoning** or tool data. -------------------------------- 🧾 VERSIONING LOGIC -------------------------------- Use Google Sheets context to determine versioning: - If content_id already exists: - Increment version_no (ex: 2 → 3) - Create new version_id as "VER-00X"_配置 Slack 审批工作流
Request Human Approval via Slack 节点使用 sendAndWait 操作,向指定频道发送优化后的标题、元描述和元数据。团队成员可在 Slack 中点击批准或拒绝。Check Human Approval Status 节点检查 $json.data.approved 是否为 true,若为 true 则发送成功通知。注意:该 IF 节点仅配置了批准分支(true→success),缺少拒绝后的处理路径,拒绝后工作流将无后续动作。需将 channelId 从 [Your Slack Channel ID] 替换为实际频道 ID。
配置 Sheets 保存与版本管理
Save Approved Draft to Sheet 节点执行 appendOrUpdate 操作,以 content_id 为匹配列。来源中的字段映射如下:topic←title、meta_title←title、meta_desc←meta_description、keywords←keywords_used、tone←improvements、word_count←word_count、section←sections、timestamp←timestamp、content_id←content_id、version_id←version_id、version_no←version_no、context_used←content_id。注意 tone 实际映射为 improvements、context_used 实际映射为 content_id,存在语义错位,复现前请核对 Sheet 列名是否与映射匹配。此外,该节点与 Request Human Approval via Slack 从 AI Agent 同一 main 输出并行触发,存在未获审批即执行保存的风险,建议根据业务需求调整连线为串行结构。
测试与部署
先手动运行一次完整流程,验证:SERP 数据是否正常返回、Pinecone 检索是否命中、AI 输出是否符合 JSON schema、Slack 审批消息是否送达、Sheets 字段映射是否正确。确认无误后激活 Chat Trigger,即可通过聊天界面按需触发内容优化。
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限,并提示已知结构限制
这一段是提示词,页面不会在这里插入广告。
你是一个熟悉 n8n 和 SEO 工作流搭建的助手。用户想复现 n8n 模板 #10832(AI SEO 内容优化 + SERP 分析 + Slack 审批)。请先确认用户是否已准备好以下凭证:OpenAI API key、Google Sheets OAuth2、SerpAPI key、Slack Bot Token、Pinecone API key。然后指导用户按步骤替换模板中的占位符(Sheet ID、Slack Channel ID、Pinecone 索引名),特别注意 Save Approved Draft to Sheet 的字段映射错位(tone←improvements 等),并检查 AI Agent 的 User Prompt 与 System Message 是否需要根据实际业务调整。提醒用户 Check Human Approval Status 缺少拒绝分支,以及 Agent 后并行触发可能导致的未审批保存风险。最后建议先手动测试再激活触发器。
本提示词用于启动搭建对话,不是节点运行指令。实际执行提示词见步骤 3 的 prompts。
来源
AI-powered SEO content optimization with SERP analysis & Slack approval workflow · rahul08 · n8n.io · 2025-11-14
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。