8
n8n 中文网amn8n.com

使用Dumpling AI和GPT-4o自动生成AI新闻评论

中级

这是一个AI, Marketing领域的自动化工作流,包含 14 个节点。主要使用 Code, Wait, SplitOut, Aggregate, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用Dumpling AI和GPT-4o自动生成AI新闻评论

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "M8PPLx0heLyG4kmQ",
  "meta": {
    "instanceId": "a1ae5c8dc6c65e674f9c3947d083abcc749ef2546dff9f4ff01de4d6a36ebfe6",
    "templateCredsSetupCompleted": true
  },
  "name": "使用Dumpling AI和GPT-4o自动生成AI新闻评论",
  "tags": [],
  "nodes": [
    {
      "id": "35ce9dd5-cc21-4cf9-a7ac-6cc9718fa86a",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -420,
        -160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c572b2c3-9e72-4d7d-89f9-364aa5c00f79",
      "name": "按计划运行(每日)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1080,
        -60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "412b5965-1278-4748-8d77-4c85d9eb9cff",
      "name": "获取无评论的主题",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -860,
        -60
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "generated commentary"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rCXEWnIZd6cKIqsVRRynHEygQTztJM76rm4HM8Xlqbw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rCXEWnIZd6cKIqsVRRynHEygQTztJM76rm4HM8Xlqbw/edit?usp=drivesdk",
          "cachedResultName": "News articles"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GaJqJHuS5mQxap7q",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c04e7811-4e30-4e68-8342-55d79669072e",
      "name": "遍历每个主题",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -640,
        -60
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "435798d5-59b3-4379-831a-9b8801a99f38",
      "name": "新闻搜索前等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        -420,
        40
      ],
      "webhookId": "2f67769b-0637-4b7e-9324-f8ba9520969c",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f0098d01-fa3b-40e8-aeeb-e9dd31606ddb",
      "name": "使用Dumpling AI搜索新闻",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        40
      ],
      "parameters": {
        "url": "https://app.dumplingai.com/api/v1/search-news",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"query\": \"{{ $json.Topic }}\",\n  \"country\": \"US\",\n  \"page\": 3,\n  \"language\": \"en\"\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "RLFzAcGRepr5eXZB",
          "name": "Dumpling AI-n8n"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "43862942-4e19-4856-a3b0-2546d8a7a462",
      "name": "分割返回的新闻文章",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        20,
        40
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "news"
      },
      "typeVersion": 1
    },
    {
      "id": "9b45eb16-66b1-45bc-b4a3-5ad46696b295",
      "name": "使用Dumpling AI抓取文章内容",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        40
      ],
      "parameters": {
        "url": "https://app.dumplingai.com/api/v1/scrape",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"url\": \"{{ $json.link}}\"\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "RLFzAcGRepr5eXZB",
          "name": "Dumpling AI-n8n"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ffa392af-04d1-4c6a-a05e-f63f765d7eca",
      "name": "聚合抓取的文章内容",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        460,
        40
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "content"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5204f7c9-e5f8-4594-9428-4b46e92ba81d",
      "name": "清理文章内容",
      "type": "n8n-nodes-base.code",
      "position": [
        680,
        40
      ],
      "parameters": {
        "jsCode": "let rawContent = $input.first().json.content;\n\n// If content is not a string, try to stringify it\nif (typeof rawContent !== 'string') {\n  rawContent = JSON.stringify(rawContent);\n}\n\nconst cleaned = rawContent\n  .replace(/https?:\\/\\/[^\\s]+/g, '')           // Remove full URLs\n  .replace(/www\\.[^\\s]+/g, '')                  // Remove www links\n  .replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '$1')    // Remove markdown links\n  .replace(/<a[^>]*>(.*?)<\\/a>/gi, '$1')        // Remove HTML anchor tags\n  .replace(/\\s{2,}/g, ' ')                      // Remove extra spaces\n  .trim();\n\nreturn [{\n  json: {\n    cleaned_content: cleaned\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "04fe4476-023b-49a5-8e72-0d251d78ae1a",
      "name": "生成LinkedIn评论(GPT-4o)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        900,
        40
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a thought leader on LinkedIn. I will provide you with a news articles related to {{ $('Fetch Topics with Empty Commentary').item.json.Topic }}, and you will write a personal commentary in a confident, insightful, first-person voice.\n\nYour response should:\n- Start with a strong personal opinion or observation\n- Briefly connect the news to real-world trends or implications\n- Mention how this relates to your work, experience, or thinking\n- Use a human tone, no robotic phrasing or generic statements\n- End with a question or call to action to invite engagement\n\nKeep it under 600 characters. Avoid buzzwords or fluff. Be authentic.\n\nHere are the news articles:{{ $json.cleaned_content }}\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "dd8NvMC6rvx8RITo",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "ecc25fb7-52c0-4b89-94eb-06088b92e095",
      "name": "将评论附加回表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1260,
        40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Topic": "={{ $('Fetch Topics with Empty Commentary').item.json.Topic }}",
            "generated commentary": "={{ $json.message.content }}"
          },
          "schema": [
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "generated commentary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "generated commentary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Topic"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rCXEWnIZd6cKIqsVRRynHEygQTztJM76rm4HM8Xlqbw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1rCXEWnIZd6cKIqsVRRynHEygQTztJM76rm4HM8Xlqbw/edit?usp=drivesdk",
          "cachedResultName": "News articles"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GaJqJHuS5mQxap7q",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "62e5001b-0aa9-40eb-bf65-6ca6ff1e3b32",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1100,
        -260
      ],
      "parameters": {
        "width": 1100,
        "height": 340,
        "content": "### 📥 通过Dumpling AI获取主题并搜索新闻"
      },
      "typeVersion": 1
    },
    {
      "id": "3c3904a5-90d3-486a-8f69-bb6b33b5d234",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -280
      ],
      "parameters": {
        "width": 1120,
        "height": 360,
        "content": "### ✍️ 抓取文章、清理文本、生成评论并附加"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2f3ec71f-7ba1-46bf-bbd3-633a9e526a47",
  "connections": {
    "Clean Article Content": {
      "main": [
        [
          {
            "node": "Generate LinkedIn Commentary (GPT-4o)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Through Each Topic": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait Before News Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run on Schedule (Daily)": {
      "main": [
        [
          {
            "node": "Fetch Topics with Empty Commentary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before News Search": {
      "main": [
        [
          {
            "node": "Search News with Dumpling AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search News with Dumpling AI": {
      "main": [
        [
          {
            "node": "Split Returned News Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Returned News Articles": {
      "main": [
        [
          {
            "node": "Scrape Article Content with Dumpling AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Commentary Back to Sheet": {
      "main": [
        [
          {
            "node": "Loop Through Each Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Scraped Article Content": {
      "main": [
        [
          {
            "node": "Clean Article Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Topics with Empty Commentary": {
      "main": [
        [
          {
            "node": "Loop Through Each Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate LinkedIn Commentary (GPT-4o)": {
      "main": [
        [
          {
            "node": "Append Commentary Back to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Article Content with Dumpling AI": {
      "main": [
        [
          {
            "node": "Aggregate Scraped Article Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能, 营销

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流