8
n8n 中文网amn8n.com

遍历项目 — 入门示例

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Code, ManualTrigger, SplitInBatches, Agent 等节点。 遍历项目 — 入门示例

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "efb474b59b0341d7791932605bd9ff04a6c7ed9941fdd53dc4a2e4b99a6f9439",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "bdd87769-9f12-4bd1-8dd9-1b90ec218209",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        600,
        -540
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "6209e2d5-4c6e-4239-8275-a8d3411cb6f9",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        820,
        -120
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "ghJTvay8CvwXDsXz",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8e3ecba2-5a55-40bc-ba3a-b3cb0d581630",
      "name": "工具:注入创意",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1060,
        -100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a73bc4ac-78f7-4410-ac1a-0952415dbe9f",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -900
      ],
      "parameters": {
        "width": 2260,
        "height": 1140,
        "content": "## 📬 需要帮助或想要自定义此工作流?"
      },
      "typeVersion": 1
    },
    {
      "id": "a523d13f-653d-4a91-a672-b0bd5d558f27",
      "name": "运行工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        220,
        -680
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f0e1af9b-2785-47b1-a38c-3e108bff67f8",
      "name": "创建随机数据",
      "type": "n8n-nodes-base.code",
      "position": [
        380,
        -540
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      row_number: 2,\n      id: 1,\n      Date: '2025-07-30',\n      idea: 'n8n rises to the top',\n      caption: '',\n      complete: ''\n    }\n  },\n  {\n    json: {\n      row_number: 3,\n      id: 2,\n      Date: '2025-07-31',\n      idea: 'n8n nodes',\n      caption: '',\n      complete: ''\n    }\n  },\n  {\n    json: {\n      row_number: 4,\n      id: 3,\n      Date: '2025-08-01',\n      idea: 'n8n use cases for marketing',\n      caption: '',\n      complete: ''\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8891b681-a7cf-44c0-aff7-79e7774120d1",
      "name": "创建标题",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        860,
        -380
      ],
      "parameters": {
        "text": "=idea: {{ $json.idea }}",
        "options": {
          "systemMessage": "You are a helpful assistant creating captions for a linkedin post. Please create a linkedin caption for the idea. "
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "fa53cf32-03de-4667-80bb-b28f8c3a16aa",
      "name": "输出表格",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        -600
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "331d2ca1-da0d-41ec-ac82-abe78052b84c",
              "name": "idea",
              "type": "string",
              "value": "={{ $('Create Random Data').item.json.idea }}"
            },
            {
              "id": "019369d9-ae99-4c29-b31d-013e29c4fdb6",
              "name": "output",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "pinData": {},
  "connections": {
    "Run Workflow": {
      "main": [
        [
          {
            "node": "Create Random Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Captions": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Output Table",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Captions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Create Captions",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Random Data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tool: Inject Creativity": {
      "ai_tool": [
        [
          {
            "node": "Create Captions",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流