8
n8n 中文网amn8n.com

通过 OpenAI GPT-4o 进行 AI 内容生成,包含人工审核与一键批准工作流

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 23 个节点。主要使用 If, Set, Code, Gmail, Webhook 等节点。 使用GPT-4o简化内容创建,集成一键人工审核批准

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "QQvh5D3K5kyo0IgA",
  "meta": {
    "instanceId": "b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502"
  },
  "name": "通过 OpenAI GPT-4o 进行 AI 内容生成,包含人工审核与一键批准工作流",
  "tags": [],
  "nodes": [
    {
      "id": "ce14c76d-7e1a-49e3-a072-7fd02ddc0419",
      "name": "📥 内容请求表单",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "79adff4f-bffa-47ef-9e28-6bad05d94d89",
      "parameters": {
        "path": "79adff4f-bffa-47ef-9e28-6bad05d94d89",
        "options": {},
        "formTitle": "🎨 AI Content Request",
        "formFields": {
          "values": [
            {
              "fieldType": "dropdown",
              "fieldLabel": "Content Type",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Blog Post"
                  },
                  {
                    "option": "Social Media Post"
                  },
                  {
                    "option": "Email Newsletter"
                  },
                  {
                    "option": "Product Description"
                  },
                  {
                    "option": "Video Script"
                  },
                  {
                    "option": "Press Release"
                  },
                  {
                    "option": "Case Study"
                  },
                  {
                    "option": "Landing Page Copy"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Topic / Title",
              "requiredField": true
            },
            {
              "fieldLabel": "Target Audience",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Key Points / Requirements",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Tone of Voice",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Professional"
                  },
                  {
                    "option": "Casual & Friendly"
                  },
                  {
                    "option": "Technical & Expert"
                  },
                  {
                    "option": "Inspirational"
                  },
                  {
                    "option": "Humorous"
                  },
                  {
                    "option": "Educational"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Word Count",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Short (300-500 words)"
                  },
                  {
                    "option": "Medium (800-1200 words)"
                  },
                  {
                    "option": "Long (1500-2500 words)"
                  }
                ]
              }
            },
            {
              "fieldType": "email",
              "fieldLabel": "Reviewer Email",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Priority",
              "fieldOptions": {
                "values": [
                  {
                    "option": "🔴 Urgent (24h)"
                  },
                  {
                    "option": "🟡 Normal (3 days)"
                  },
                  {
                    "option": "🟢 Low (1 week)"
                  }
                ]
              }
            }
          ]
        },
        "formDescription": "Submit your content requirements and let AI create the first draft. You'll review and approve before publishing."
      },
      "typeVersion": 2.1
    },
    {
      "id": "5b21fbcc-a5c0-4b3a-a9e1-5cb05d591bd2",
      "name": "🤖 生成 AI 内容",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        464,
        0
      ],
      "parameters": {
        "text": "=You are an expert content writer specializing in {{ $json.contentType }}.\n\n**Assignment:**\nCreate engaging {{ $json.contentType }} content about: {{ $json.topic }}\n\n**Target Audience:** {{ $json.audience }}\n\n**Tone:** {{ $json.tone }}\n\n**Word Count Target:** {{ $json.wordTarget }} words\n\n**Requirements:**\n{{ $json.requirements }}\n\n**Instructions:**\n1. Research the topic thoroughly\n2. Write in the specified tone consistently\n3. Include compelling headlines/hooks\n4. Add relevant examples and data points\n5. Include a clear call-to-action\n6. Optimize for readability (short paragraphs, subheadings)\n7. If blog post, include SEO-optimized meta description\n\n**Format:**\nTitle: [Compelling title here]\n\nMeta Description: [If applicable]\n\n[Main content body]\n\nCTA: [Call to action]\n\n---\n\nBegin writing now:",
        "promptType": "define"
      },
      "typeVersion": 1.4
    },
    {
      "id": "7e5c33e0-c201-4287-a0bf-2fdf64f3a86c",
      "name": "OpenAI GPT-4o",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        464,
        144
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "maxTokens": 3000,
          "temperature": 0.7
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "OGYj7DgYv5GFLFZk",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a08011d4-30c4-49d1-a80c-2197e058952e",
      "name": "🔗 生成审核链接",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        224
      ],
      "parameters": {
        "jsCode": "// Generate review links (webhook URLs for approve/reject/edit)\nconst baseUrl = $env.WEBHOOK_URL || 'https://your-n8n-instance.com';\nconst requestId = $json.requestId;\n\nconst reviewLinks = {\n  approve: `${baseUrl}/webhook/content-review?action=approve&id=${requestId}`,\n  reject: `${baseUrl}/webhook/content-review?action=reject&id=${requestId}`,\n  requestEdit: `${baseUrl}/webhook/content-review?action=edit&id=${requestId}`\n};\n\nreturn [{\n  json: {\n    ...$json,\n    reviewLinks: reviewLinks\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7420d0ad-1c5c-4c51-9f88-eb13e92dddb8",
      "name": "📧 创建审核邮件",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        464
      ],
      "parameters": {
        "jsCode": "// Create beautiful HTML email for review\nconst data = $input.first().json;\n\nconst html = `\n<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 0; background: #f4f4f4; }\n    .container { max-width: 700px; margin: 20px auto; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }\n    .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center; }\n    .header h1 { margin: 0; font-size: 28px; }\n    .badge { display: inline-block; background: rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 20px; font-size: 14px; margin-top: 10px; }\n    .content { padding: 30px; }\n    .meta { background: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 20px; }\n    .meta-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e0e0e0; }\n    .meta-item:last-child { border-bottom: none; }\n    .meta-label { font-weight: 600; color: #666; }\n    .meta-value { color: #333; }\n    .quality-score { text-align: center; padding: 20px; background: ${data.stats.qualityScore >= 80 ? '#d1fae5' : data.stats.qualityScore >= 60 ? '#fef3c7' : '#fee2e2'}; border-radius: 8px; margin: 20px 0; }\n    .quality-number { font-size: 48px; font-weight: bold; color: ${data.stats.qualityScore >= 80 ? '#065f46' : data.stats.qualityScore >= 60 ? '#92400e' : '#991b1b'}; margin: 0; }\n    .draft-content { background: #fafafa; padding: 25px; border-left: 4px solid #667eea; border-radius: 4px; margin: 20px 0; max-height: 500px; overflow-y: auto; }\n    .draft-content pre { white-space: pre-wrap; font-family: inherit; line-height: 1.6; }\n    .actions { display: flex; gap: 15px; margin-top: 30px; }\n    .btn { flex: 1; padding: 15px 30px; text-align: center; text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 16px; transition: all 0.3s; }\n    .btn-approve { background: #10b981; color: white; }\n    .btn-approve:hover { background: #059669; }\n    .btn-edit { background: #f59e0b; color: white; }\n    .btn-edit:hover { background: #d97706; }\n    .btn-reject { background: #ef4444; color: white; }\n    .btn-reject:hover { background: #dc2626; }\n    .footer { background: #f8f9fa; padding: 20px; text-align: center; color: #666; font-size: 14px; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"header\">\n      <h1>✨ AI Content Ready for Review</h1>\n      <span class=\"badge\">${data.requestId}</span>\n    </div>\n    \n    <div class=\"content\">\n      <h2>📋 Content Details</h2>\n      <div class=\"meta\">\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Content Type:</span>\n          <span class=\"meta-value\">${data.contentType}</span>\n        </div>\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Topic:</span>\n          <span class=\"meta-value\">${data.topic}</span>\n        </div>\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Target Audience:</span>\n          <span class=\"meta-value\">${data.audience}</span>\n        </div>\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Tone:</span>\n          <span class=\"meta-value\">${data.tone}</span>\n        </div>\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Word Count:</span>\n          <span class=\"meta-value\">${data.stats.wordCount} words (${data.stats.readingTime} min read)</span>\n        </div>\n        <div class=\"meta-item\">\n          <span class=\"meta-label\">Priority:</span>\n          <span class=\"meta-value\">${data.priority}</span>\n        </div>\n      </div>\n\n      <div class=\"quality-score\">\n        <p style=\"margin: 0 0 10px 0; color: #666; font-weight: 600;\">AI Quality Score</p>\n        <p class=\"quality-number\">${data.stats.qualityScore}/100</p>\n        <p style=\"margin: 10px 0 0 0; color: #666; font-size: 14px;\">\n          ${data.stats.qualityScore >= 80 ? '🎉 Excellent Quality' : data.stats.qualityScore >= 60 ? '✅ Good Quality' : '⚠️ Needs Review'}\n        </p>\n      </div>\n\n      <h3>📝 Generated Content Draft</h3>\n      <div class=\"draft-content\">\n        <pre>${data.aiDraft}</pre>\n      </div>\n\n      <h3>🎬 Take Action</h3>\n      <p style=\"color: #666;\">Review the content above and choose an action:</p>\n      \n      <div class=\"actions\">\n        <a href=\"${data.reviewLinks.approve}\" class=\"btn btn-approve\">✅ Approve & Publish</a>\n        <a href=\"${data.reviewLinks.requestEdit}\" class=\"btn btn-edit\">✏️ Request Changes</a>\n        <a href=\"${data.reviewLinks.reject}\" class=\"btn btn-reject\">❌ Reject</a>\n      </div>\n\n      <p style=\"margin-top: 20px; padding: 15px; background: #f0f9ff; border-left: 4px solid #3b82f6; border-radius: 4px; font-size: 14px;\">\n        <strong>💡 Tip:</strong> Click the buttons above to take action instantly. The content will be automatically updated in your tracking sheet.\n      </p>\n    </div>\n\n    <div class=\"footer\">\n      <p>Generated by AI Content Workflow</p>\n      <p style=\"font-size: 12px; color: #999;\">Request ID: ${data.requestId} | ${new Date(data.generatedAt).toLocaleString()}</p>\n    </div>\n  </div>\n</body>\n</html>\n`;\n\nreturn [{\n  json: {\n    ...data,\n    htmlEmail: html\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f5f4e6d0-3105-477a-93d4-bbcf8fe56424",
      "name": "🔔 审核操作 Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        64,
        400
      ],
      "webhookId": "f077ff3f-1a68-4c38-a010-527f8d519e96",
      "parameters": {
        "path": "f077ff3f-1a68-4c38-a010-527f8d519e96",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "251d2073-ffc5-4f28-998a-465c79afcf17",
      "name": "检查:批准?",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "action_approve",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.query.action }}",
              "rightValue": "approve"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "66ad077c-5a6a-4ab5-8051-4ad012bbc2f1",
      "name": "检查:拒绝?",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        496
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "action_reject",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.query.action }}",
              "rightValue": "reject"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "05890ffb-139d-4b9f-9357-bfd0a020d49f",
      "name": "✅ 更新:已批准",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        256
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "approved",
            "Approved At": "={{ $now.toISO() }}",
            "Final Content": "={{ $json.aiDraft || 'See AI Draft column' }}",
            "Review Status": "Approved"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "8c174f9c-5452-4cf4-82b0-6cd1c4a4362c",
      "name": "❌ 更新:已拒绝",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        560
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "rejected",
            "Rejected At": "={{ $now.toISO() }}",
            "Review Status": "Rejected"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "8766daca-9d03-43d1-84e7-310fb437d2b4",
      "name": "✏️ 更新:需要编辑",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        400
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "revision_requested",
            "Review Status": "Needs Changes",
            "Revision Requested At": "={{ $now.toISO() }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "ca6fd14f-4f48-4203-9173-c2b67049699c",
      "name": "响应:已批准",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        672,
        256
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }\n    .card { background: white; padding: 50px; border-radius: 12px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); max-width: 500px; }\n    .icon { font-size: 72px; margin-bottom: 20px; }\n    h1 { color: #333; margin: 0 0 10px 0; }\n    p { color: #666; line-height: 1.6; }\n    .btn { display: inline-block; margin-top: 20px; padding: 12px 30px; background: #667eea; color: white; text-decoration: none; border-radius: 6px; font-weight: 600; }\n  </style>\n</head>\n<body>\n  <div class=\"card\">\n    <div class=\"icon\">✅</div>\n    <h1>Content Approved!</h1>\n    <p>The content has been marked as approved and is ready for publishing.</p>\n    <p><strong>Request ID:</strong> {{ $json.query.id }}</p>\n    <a href=\"#\" class=\"btn\">Close This Tab</a>\n  </div>\n</body>\n</html>"
      },
      "typeVersion": 1.1
    },
    {
      "id": "3f097f0e-c27f-4d86-8f12-8ddfca48ce6e",
      "name": "响应:请求编辑",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        672,
        400
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }\n    .card { background: white; padding: 50px; border-radius: 12px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); max-width: 500px; }\n    .icon { font-size: 72px; margin-bottom: 20px; }\n    h1 { color: #333; margin: 0 0 10px 0; }\n    p { color: #666; line-height: 1.6; }\n  </style>\n</head>\n<body>\n  <div class=\"card\">\n    <div class=\"icon\">✏️</div>\n    <h1>Changes Requested</h1>\n    <p>The content has been marked for revision. The team will be notified.</p>\n    <p><strong>Request ID:</strong> {{ $json.query.id }}</p>\n  </div>\n</body>\n</html>"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ace69455-eb47-4db3-b047-899dfdaaf93c",
      "name": "响应:已拒绝",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        672,
        560
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }\n    .card { background: white; padding: 50px; border-radius: 12px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); max-width: 500px; }\n    .icon { font-size: 72px; margin-bottom: 20px; }\n    h1 { color: #333; margin: 0 0 10px 0; }\n    p { color: #666; line-height: 1.6; }\n  </style>\n</head>\n<body>\n  <div class=\"card\">\n    <div class=\"icon\">❌</div>\n    <h1>Content Rejected</h1>\n    <p>The content has been rejected. It will not be published.</p>\n    <p><strong>Request ID:</strong> {{ $json.query.id }}</p>\n  </div>\n</body>\n</html>"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d0048863-ec2f-4219-9a9e-1461234d9243",
      "name": "记录到跟踪表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        336,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Tone": "={{ $json.tone }}",
            "Topic": "={{ $json.topic }}",
            "Status": "={{ $json.status }}",
            "AI Draft": "",
            "Audience": "={{ $json.audience }}",
            "Priority": "={{ $json.priority }}",
            "Reviewer": "={{ $json.reviewerEmail }}",
            "Created At": "={{ $json.createdAt }}",
            "Request ID": "={{ $json.requestId }}",
            "Word Count": "={{ $json.wordCount }}",
            "Content Type": "={{ $json.contentType }}",
            "Published At": "",
            "Final Content": "",
            "Review Status": ""
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hQFe8XTqJEiHL03Z",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "e0142757-2a6d-41ca-805e-e8e703c0a260",
      "name": "准备请求数据",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "request_id",
              "name": "requestId",
              "type": "string",
              "value": "={{ 'REQ-' + $now.format('yyyyMMdd-HHmmss') }}"
            },
            {
              "id": "created_at",
              "name": "createdAt",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "status",
              "name": "status",
              "type": "string",
              "value": "pending_generation"
            },
            {
              "id": "word_target",
              "name": "wordTarget",
              "type": "number",
              "value": "={{ $json.wordCount === 'Short (300-500 words)' ? 400 : $json.wordCount === 'Medium (800-1200 words)' ? 1000 : 2000 }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9fff0e38-434d-4fe6-bb69-1c705391c1e6",
      "name": "使用草稿更新表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        896,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "={{ $json.status }}",
            "AI Draft": "={{ $json.aiDraft }}",
            "Word Count": "={{ $json.stats.wordCount }}",
            "Generated At": "={{ $json.generatedAt }}",
            "Quality Score": "={{ $json.stats.qualityScore }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Requests"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hQFe8XTqJEiHL03Z",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "1fb00659-6ff0-49a8-bb4a-b2f603c5fd4c",
      "name": "处理生成的内容",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        0
      ],
      "parameters": {
        "jsCode": "// Extract and structure the generated content\nconst generatedText = $input.first().json.output || $input.first().json.response || $input.first().json.text;\nconst requestData = $('Prepare Request Data').first().json;\n\n// Word count\nconst wordCount = generatedText.split(/\\s+/).length;\n\n// Extract title (first line usually)\nconst lines = generatedText.split('\\n').filter(line => line.trim());\nconst title = lines[0].replace(/^(Title:|#)\\s*/i, '').trim();\n\n// Calculate quality score (simple heuristic)\nfunction calculateQualityScore(text) {\n  let score = 70; // Base score\n  \n  // Length check\n  const words = text.split(/\\s+/).length;\n  if (words >= requestData.wordTarget * 0.8 && words <= requestData.wordTarget * 1.2) {\n    score += 10;\n  }\n  \n  // Has subheadings\n  if (text.match(/^#{1,3}\\s|^\\*\\*.*\\*\\*$/m)) {\n    score += 5;\n  }\n  \n  // Has bullet points or numbered lists\n  if (text.match(/^[-*]\\s|^\\d+\\.\\s/m)) {\n    score += 5;\n  }\n  \n  // Has CTA\n  if (text.toLowerCase().includes('call to action') || text.toLowerCase().includes('cta:')) {\n    score += 5;\n  }\n  \n  // Not too repetitive (check for repeated phrases)\n  const sentences = text.split(/[.!?]+/);\n  const uniqueSentences = new Set(sentences);\n  if (uniqueSentences.size / sentences.length > 0.8) {\n    score += 5;\n  }\n  \n  return Math.min(score, 100);\n}\n\nconst qualityScore = calculateQualityScore(generatedText);\n\n// Extract key stats\nconst stats = {\n  wordCount: wordCount,\n  paragraphCount: generatedText.split('\\n\\n').length,\n  hasTitle: title.length > 0,\n  hasCTA: generatedText.toLowerCase().includes('cta:') || generatedText.toLowerCase().includes('call to action'),\n  qualityScore: qualityScore,\n  readingTime: Math.ceil(wordCount / 200) // Average reading speed\n};\n\nreturn [{\n  json: {\n    ...requestData,\n    aiDraft: generatedText,\n    title: title,\n    stats: stats,\n    generatedAt: new Date().toISOString(),\n    status: 'pending_review'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1c312090-0c64-4fd8-b3ce-77e404cae043",
      "name": "✉️ 发送审核请求",
      "type": "n8n-nodes-base.gmail",
      "position": [
        896,
        672
      ],
      "webhookId": "1edd5912-320f-4117-ae15-95f7f7617707",
      "parameters": {
        "sendTo": "={{ $json.reviewerEmail }}",
        "message": "={{ $json.htmlEmail }}",
        "options": {},
        "subject": "=🎨 AI Content Ready: {{ $json.title }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "TbUa3sBo9ouHTYFh",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c2ce5185-a1b4-4458-af16-1f62a4dc23e9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        400
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "height": 208,
        "content": "### 工作流阶段"
      },
      "typeVersion": 1
    },
    {
      "id": "38ecff9e-9415-40ad-b55f-b2b0ddfbc9b2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        160
      ],
      "parameters": {
        "color": 5,
        "width": 656,
        "height": 336,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "11b0f0a9-331b-4a9f-80a0-baa02193d7b3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        0
      ],
      "parameters": {
        "width": 416,
        "height": 384,
        "content": "## 工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "f4b1b128-2ef8-4e8b-b09c-10cbfb665bae",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 656,
        "height": 128,
        "content": "## 概述"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3c523822-afaf-4a71-989e-a4640aee4178",
  "connections": {
    "OpenAI GPT-4o": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 Generate AI Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check: Reject?": {
      "main": [
        [
          {
            "node": "❌ Update: Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check: Approve?": {
      "main": [
        [
          {
            "node": "✅ Update: Approved",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "✏️ Update: Needs Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Request Data": {
      "main": [
        [
          {
            "node": "Log to Tracking Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "✅ Update: Approved": {
      "main": [
        [
          {
            "node": "Respond: Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "❌ Update: Rejected": {
      "main": [
        [
          {
            "node": "Respond: Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Tracking Sheet": {
      "main": [
        [
          {
            "node": "🤖 Generate AI Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Sheet with Draft": {
      "main": [
        [
          {
            "node": "🔗 Generate Review Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📧 Create Review Email": {
      "main": [
        [
          {
            "node": "✉️ Send Review Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 Generate AI Content": {
      "main": [
        [
          {
            "node": "Process Generated Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Generated Content": {
      "main": [
        [
          {
            "node": "Update Sheet with Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "✏️ Update: Needs Edit": {
      "main": [
        [
          {
            "node": "Respond: Edit Requested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📥 Content Request Form": {
      "main": [
        [
          {
            "node": "Prepare Request Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔔 Review Action Webhook": {
      "main": [
        [
          {
            "node": "Check: Approve?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check: Reject?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔗 Generate Review Links": {
      "main": [
        [
          {
            "node": "📧 Create Review Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Cheng Siong Chin

Cheng Siong Chin

@cschin

Dr. Cheng Siong CHIN serves as a Professor in Intelligent Systems Modelling and Simulation in Newcastle University, Singapore. His academic credentials include an M.Sc. in Advanced Control and Systems Engineering from The University of Manchester and a Ph.D. in Robotics from Nanyang Technological University.

外部链接
在 n8n.io 查看

分享此工作流