8
n8n 中文网amn8n.com

使用 OpenAI、Google Sheets 和邮件审批流程自动化博客内容创建

高级

这是一个AI, Marketing领域的自动化工作流,包含 22 个节点。主要使用 Set, Gmail, Switch, GoogleSheets, Agent 等节点,结合人工智能技术实现智能自动化。 使用 OpenAI、Google Sheets 和邮件审批流程自动化博客内容创建

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "d1786ab0d745a7498abf13a9c2cdabb1374c006e889b79eef64ce0386b8f8a41",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "44e86584-788d-429b-b74c-87db2807ce5c",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -820,
        40
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efee3941-0589-4666-b2cb-43b221732b18",
      "name": "文案AI代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -160,
        -40
      ],
      "parameters": {
        "text": "=You are an expert-level SEO content strategist and copywriter with years of experience writing high-performing blog posts.\n\nYour task is to:\n\n1. Improve the provided topic title by generating a better, SEO-optimized blog post title that is more attractive and ranks well on search engines.\n\n2. Write a complete blog post based on the improved title. The post must:\n- Be between 800–1200 words\n- Use a clear, conversational, and engaging tone\n- Be SEO-friendly with natural keyword integration\n- Start with a hooking introduction that introduces the topic smoothly\n- Use headings and subheadings (H1 for the title, H2 for main sections, H3 for supporting points)\n- Use bullet points or numbered lists where helpful\n- Have a strong conclusion that summarizes the key points and includes a call-to-action or final insight\n- Ensure smooth flow and concise, informative paragraphs\n\n3. Output the result as a JSON object with this format:\n\n```json\n{\n  \"title\": \"Improved SEO-Optimized Title\",\n  \"content\": \"Full blog post content in markdown format\"\n}\n```\n\nHere is the topic you should improve and write about:\n{{ $json.Topic }}\n\nGenerate the improved title and the full blog post now.\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "e50273d0-e7c4-4467-b91d-ff1c08128bd0",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -180,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "MGwGMKEkdcjzlYCw",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bb251d01-b847-475b-b5cf-79665cab92ad",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        20,
        260
      ],
      "parameters": {
        "sessionKey": "={{ $('Get Topic from Google Sheets').item.json.Topic }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "8c0ff9a8-3484-41cd-a614-6880212fb4a2",
      "name": "文案修订助手",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        340,
        420
      ],
      "parameters": {
        "text": "=You are an expert-level copywriter with strong SEO knowledge and a clear, engaging writing style. Your task is to revise an existing blog post based on the given topic and user feedback.\n\nHere are your responsibilities:\n- Carefully apply all of the user's feedback to improve the blog post.\n- Preserve the good parts of the original content, but rewrite or adjust areas based on the feedback.\n- Keep the tone friendly, professional, and easy to read.\n- Organize the blog post with clear headings and subheadings.\n- Use bullet points or numbered lists when it makes the content clearer.\n- Ensure a strong hook in the introduction and a solid conclusion with a call-to-action or takeaway.\n- Aim for a length between 800–1200 words unless the feedback suggests otherwise.\n\nHere is the topic title:\n{{ $('Get Topic from Google Sheets').item.json.Topic }}\n\nHere is the user's feedback:\n{{ $('Send Content for Approval').item.json.data['Content Feedback'] }}\n\nHere is the original content:\n{{ $('Copywriter AI Agent').item.json.output }}\n\nNow, rewrite the blog post using this input, fully incorporating the feedback.\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "00a499d7-7897-4e47-8559-1fb78c49e1d6",
      "name": "设置数据",
      "type": "n8n-nodes-base.set",
      "position": [
        280,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c4dbce1a-8b34-46b7-a740-b49339233e68",
              "name": "Topic Title",
              "type": "string",
              "value": "={{ $json.output.title }}"
            },
            {
              "id": "4924b496-db60-4618-bab7-a9d5e689c8eb",
              "name": "Content",
              "type": "string",
              "value": "={{ $json.output.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "74287c5b-12a3-4a39-802c-40c98ab72bfa",
      "name": "多表:您可以连接多个表以实现有组织的数据结构",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        120,
        440
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"title\": \"Improved SEO-Optimized Title\",\n  \"content\": \"Full blog post content in markdown format\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "c288be21-d948-4d10-87c9-795049c64ee3",
      "name": "将生成内容添加到Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Title": "={{ $('Set Data').item.json['Topic Title'] }}",
            "Content": "={{ $('Set Data').item.json.Content }}",
            "Generation Date": "={{ $now }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Content",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generation Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Generation Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1579104486,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit#gid=1579104486",
          "cachedResultName": "Generated Content"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit?usp=drivesdk",
          "cachedResultName": "Content Topics"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ypmzFxQFfAacuVVC",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "8c129e32-763c-4a7f-8e57-fec1fbbd89e4",
      "name": "在Google Sheets上更新主题状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Completed",
            "row_number": "={{ $('Get Topic from Google Sheets').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Output",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Output",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit#gid=0",
          "cachedResultName": "Topic List"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit?usp=drivesdk",
          "cachedResultName": "Content Topics"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ypmzFxQFfAacuVVC",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "066a262a-94f5-428e-b15e-a01e3b295cf7",
      "name": "从Google Sheets获取主题",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        40
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit#gid=0",
          "cachedResultName": "Topic List"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CyELzPxCDHAXJVu-p2_QRiGRGYwjPtJpeGwWXvlWjLw/edit?usp=drivesdk",
          "cachedResultName": "Content Topics"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ypmzFxQFfAacuVVC",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "f38b1a69-b222-4232-a930-7cd4dab7805b",
      "name": "发送内容进行审批",
      "type": "n8n-nodes-base.gmail",
      "position": [
        440,
        -40
      ],
      "webhookId": "a23938a4-fc6c-4445-8dee-17e501e92e06",
      "parameters": {
        "sendTo": "replace_with_your_email@yopmail.com",
        "message": "=Generated Title:\n{{ $json['Topic Title'] }}\n\nGenerated Content:\n{{ $json.Content }}",
        "options": {},
        "subject": "Approval Required for Blog Content",
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldType": "dropdown",
              "fieldLabel": "Approve Content?",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Yes"
                  },
                  {
                    "option": "No"
                  },
                  {
                    "option": "Cancel"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Content Feedback"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "sWl7FFMkEUYBj0zM",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "67f16627-daf0-4af9-b01e-1e3fc1822e1d",
      "name": "审批结果",
      "type": "n8n-nodes-base.switch",
      "position": [
        580,
        -40
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Yes",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "317039f4-754e-4cb0-a674-eb8d26c9ed27",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data['Approve Content?'] }}",
                    "rightValue": "Yes"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "No",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "caace3ea-4ca0-40de-84fb-5a8fd809a0eb",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data['Approve Content?'] }}",
                    "rightValue": "No"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Cancel",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f93e5649-6a21-49a9-9993-85f1323139b0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data['Approve Content?'] }}",
                    "rightValue": "Cancel"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "73207a91-a427-4f1a-a703-ce85aefc0dbe",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 360,
        "content": "🕒 工作流启动器"
      },
      "typeVersion": 1
    },
    {
      "id": "b058cff4-b0b2-4ee3-865c-2e3a43e91fb7",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 480,
        "content": "📊 主题获取"
      },
      "typeVersion": 1
    },
    {
      "id": "534cf5ed-a0dd-4e72-9809-33234dd82b1e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 260,
        "height": 460,
        "content": "## 所需设置"
      },
      "typeVersion": 1
    },
    {
      "id": "b73b1fb1-6b9f-402d-8127-5386ab3129bd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 800,
        "content": "🤖 内容创作"
      },
      "typeVersion": 1
    },
    {
      "id": "66a66e35-04e8-4b8f-a516-662153570419",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 440,
        "content": "📧 人工审核"
      },
      "typeVersion": 1
    },
    {
      "id": "4836beb9-5ad7-4439-a99d-ffcdc2ef92ab",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        200
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 420,
        "content": "✏️ 内容修订"
      },
      "typeVersion": 1
    },
    {
      "id": "bb912715-f4e6-4907-881e-b8fc0c1a9e10",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        -280
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 480,
        "content": "✅ 主题状态更新"
      },
      "typeVersion": 1
    },
    {
      "id": "a9ca1a23-9156-4d33-9967-586374c4eca4",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -280
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 480,
        "content": "💾 添加生成内容"
      },
      "typeVersion": 1
    },
    {
      "id": "35400105-1c1a-44e4-8e6c-684de99da88d",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 420,
        "height": 420,
        "content": "## 🚀 使用OpenAI、Google Sheets和邮件审批工作流自动化博客内容创作"
      },
      "typeVersion": 1
    },
    {
      "id": "3a54ea70-bf4f-48b7-80f2-15c8b961b8b5",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "height": 420,
        "content": "## 📋 工作流程概述"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Set Data": {
      "main": [
        [
          {
            "node": "Send Content for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Copywriter AI Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Copywriter Revision Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Approval Result": {
      "main": [
        [
          {
            "node": "Update Topic Status on Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Copywriter Revision Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Topic Status on Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Topic from Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Copywriter AI Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Copywriter Revision Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Copywriter AI Agent": {
      "main": [
        [
          {
            "node": "Set Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Copywriter AI Agent",
            "type": "ai_outputParser",
            "index": 0
          },
          {
            "node": "Copywriter Revision Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Copywriter Revision Agent": {
      "main": [
        [
          {
            "node": "Set Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Content for Approval": {
      "main": [
        [
          {
            "node": "Approval Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Topic from Google Sheets": {
      "main": [
        [
          {
            "node": "Copywriter AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Topic Status on Google Sheets": {
      "main": [
        [
          {
            "node": "Add Generated Content to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能, 营销

需要付费吗?

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

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

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

作者
Billy Christi

Billy Christi

@billy

I'm a professional software engineer and n8n expert with a passion for building scalable, no-code and low-code automation workflows. I specialize in creating seamless integrations between APIs, CRMs, and everyday tools to help businesses save time, reduce manual work, and operate smarter. Whether it's automating marketing pipelines, backend systems, or approval processes, I turn complex logic into simple, powerful workflows with n8n.

外部链接
在 n8n.io 查看

分享此工作流