8
n8n 中文网amn8n.com

使用 OpenAI 抓取和分析 Meta 广告库图片广告并将结果存储到 Google Sheets

高级

这是一个AI, Marketing领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Sort, Limit, Merge 等节点,结合人工智能技术实现智能自动化。 使用 Apify 和 OpenAI 抓取和分析 Meta 广告库图片广告

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "ERIlxRN2QNARj3RZ",
  "meta": {
    "instanceId": "0aee4372a556f3e4774323f4ed89755880cea473443f0948966509bbf55dec04",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 OpenAI 抓取和分析 Meta 广告库图片广告并将结果存储到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "0d98546f-9c0b-475d-81d3-d63c5dd18bc4",
      "name": "当点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -120,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "54f05394-221a-4e50-b4f5-50e4b7b4cc8a",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "3cac5c6a-bd72-4c39-9232-5926e4ef1cd0",
      "name": "清理提示",
      "type": "n8n-nodes-base.code",
      "position": [
        280,
        380
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a6418f56-233c-410e-8186-ff40a993c980",
      "name": "使用 Apify 抓取 Meta 广告库",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        480,
        380
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "a5502f95-ecc4-47d9-a6ef-0d17257f8255",
      "name": "传递相关字段",
      "type": "n8n-nodes-base.set",
      "position": [
        1700,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "32a72f8f-ae54-4c3c-8d1a-5859a5360275",
      "name": "计算运行天数",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "4e8f97f3-b65b-4bf3-ab30-8572af490dda",
      "name": "按覆盖范围或运行天数排序",
      "type": "n8n-nodes-base.sort",
      "position": [
        940,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b709b632-647c-4ff8-8f0a-f1f7163841ef",
      "name": "仅筛选图片广告",
      "type": "n8n-nodes-base.filter",
      "position": [
        1180,
        380
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "20255e0f-f34c-4499-b2e4-c19330047998",
      "name": "限制分析的图片数量",
      "type": "n8n-nodes-base.limit",
      "position": [
        1440,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4ccd7e75-f124-481f-be20-2d2dd7b811f9",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2380,
        320
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "66e268d4-5db5-485d-ba63-f48af4557429",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2560,
        320
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8edfd824-8571-4cc7-b1f4-2172e3d0ad47",
      "name": "下载图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1960,
        380
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "dcc7f234-14f8-4e71-8c2f-2f6611b1126d",
      "name": "分析图片内容",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        2380,
        80
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1.8
    },
    {
      "id": "2b3dbff9-da61-4f94-a77a-0728456e5c4e",
      "name": "保存图片到 Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2440,
        580
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "34c28c32-a4d2-49da-a2e9-f97bbb131031",
      "name": "合并数据",
      "type": "n8n-nodes-base.merge",
      "position": [
        2820,
        360
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "7e2af3a6-2129-4dc0-a88a-92672191b66b",
      "name": "将数据存储到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3120,
        360
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "0ba0d9b7-2b83-4131-87d1-66c68c8c776b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        260
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "69c089a0-df87-4723-8362-fb8c198fc130",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2360,
        780
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "30c23991-ebad-444e-a9da-7fc782c99739",
  "connections": {
    "Settings": {
      "main": [
        [
          {
            "node": "Clean Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data": {
      "main": [
        [
          {
            "node": "Store Data in Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Prompt": {
      "main": [
        [
          {
            "node": "Scrape Meta Ad Library with Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Save Image to Google Drive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze Image Contents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Image Contents",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pass relevant Fields": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter only Image Ads": {
      "main": [
        [
          {
            "node": "Limit Images to Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image Contents": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit Images to Analyze": {
      "main": [
        [
          {
            "node": "Pass relevant Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Image Contents",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Runtime in Days": {
      "main": [
        [
          {
            "node": "Sort by Reach or Days Running",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Image to Google Drive": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Store Data in Google Sheets": {
      "main": [
        []
      ]
    },
    "Sort by Reach or Days Running": {
      "main": [
        [
          {
            "node": "Filter only Image Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Meta Ad Library with Apify": {
      "main": [
        [
          {
            "node": "Calculate Runtime in Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能, 营销

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流