8
n8n 中文网amn8n.com

使用 Google Drive 和 Meta Graph API 从 Google Sheets 上传视频和图片广告到 Meta Ads Manager

高级

这是一个Social Media领域的自动化工作流,包含 42 个节点。主要使用 If, Set, Code, Wait, Switch 等节点。 从 Google Sheets 和 Google Drive 上传视频和图片广告到 Meta Ads Manager

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Facebook Graph API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "v8cndATocxXEg3OZ",
  "meta": {
    "instanceId": "1746813392f03a836ae1b60ce6fb98a512b5d5498aca4a9d4df49ccc7e65726f",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Google Drive 和 Meta Graph API 从 Google Sheets 上传视频和图片广告到 Meta Ads Manager",
  "tags": [],
  "nodes": [
    {
      "id": "a2202ebd-0373-4e73-b30b-8949dfedfbe0",
      "name": "获取视频预览图片",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2700,
        720
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e24c76a8-e231-4465-b797-fcbed77c7847",
      "name": "创建资源",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        260
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "05d086b0-7979-4646-b4ca-b9f74bfa0e45",
      "name": "获取待处理广告",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        540,
        880
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "097bf067-4ae1-48a8-a82e-a97ead807b82",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -180,
        940
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8f1beb92-26f1-4fa6-8812-cb13174faff0",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1900,
        720
      ],
      "webhookId": "79108ea9-8def-46c4-9eae-084348dbd30e",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "08b00090-f19c-4ee7-a783-76edac77c6b7",
      "name": "视频或图片资源",
      "type": "n8n-nodes-base.switch",
      "position": [
        1240,
        900
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "1e3b6cb3-e18e-49db-964e-d3c55010b1ab",
      "name": "获取图片 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1500,
        1020
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "de3ebe68-2989-41f4-8172-1c2e732e134c",
      "name": "获取图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2140,
        1020
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "346c3523-aa74-478f-b6da-b597843c7dea",
      "name": "Google Drive 文件夹已更新",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -220,
        260
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "29493346-314e-4c25-9c3c-2d639d92a1ab",
      "name": "获取所有文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        300,
        260
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "187ddf83-75b7-446a-84b3-38fc2a45f839",
      "name": "获取文件元数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        260
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "260ccf59-f790-4959-81c4-550061415f5e",
      "name": "提取文件规格",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        260
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "55d04cfc-d13f-4389-979c-9502ec2d0373",
      "name": "创建视频广告创意",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2940,
        720
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "de0c62a9-9ce5-48ee-950f-aa874808d3c9",
      "name": "创建视频广告",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        3180,
        720
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4a84b968-af41-450f-82de-06ddad4c3c69",
      "name": "保存视频广告详情",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3460,
        720
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "79ab59d8-0542-4cf3-b9e6-c72706ee1234",
      "name": "检查是两个还是一个图片",
      "type": "n8n-nodes-base.if",
      "position": [
        1900,
        1020
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "e298f0d5-0c36-4839-8f70-e3033d9529ce",
      "name": "上传广告图片",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1680,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "aafe76d1-180b-4798-85cd-2730970755bb",
      "name": "创建多图创意",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2580,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e943a530-7055-4165-91f1-13042c4bc4f1",
      "name": "创建图片创意",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2360,
        1260
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5c324d32-511e-4be8-846b-54d09788e400",
      "name": "上传第二个广告图片",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2360,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7a307213-2235-4560-8244-632555f326a5",
      "name": "创建图片广告",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        3180,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b6824639-94d2-45c5-aeb3-6d40eddf7fca",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7a10361d-449d-45db-8ed6-39e4d9370684",
      "name": "保存图片广告详情",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3460,
        1020
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "491c242e-2d35-41e9-87a2-1d8ed4125c69",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        700
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "fbe0cfee-f042-45be-8570-5e5a5acf372b",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "62d72497-f67c-4dce-81be-e4639c805e9a",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        680
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f162300e-7ebc-47cc-be7c-50b7fa930672",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        40,
        260
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "197ee18f-6ff3-4de5-bfff-92fae133980e",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        60
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a18f9ee0-fbce-4294-b5f5-1b55dae835e4",
      "name": "设置_1",
      "type": "n8n-nodes-base.set",
      "position": [
        180,
        880
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "d9be4468-d279-46ad-80d4-37cd967f9da2",
      "name": "上传广告视频",
      "type": "n8n-nodes-base.facebookGraphApi",
      "onError": "continueRegularOutput",
      "position": [
        1460,
        720
      ],
      "parameters": {},
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "87beffa2-756b-4bcb-9034-5af946ffa93e",
      "name": "获取视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1340,
        460
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "28ab3596-9519-4edf-83da-a2da38933657",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        1660,
        720
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "dd3bba66-e874-48da-b504-ace6c8f3b718",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        1500,
        460
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1797bc46-693e-4ac9-9e21-f325ea56dcc9",
      "name": "上传广告视频1",
      "type": "n8n-nodes-base.facebookGraphApi",
      "onError": "continueRegularOutput",
      "position": [
        1660,
        460
      ],
      "parameters": {},
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "555c9b83-68f0-4664-8401-cde5238d67b5",
      "name": "检查是否完成处理",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        2140,
        700
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "baa319b2-83ee-4050-825b-368838622b03",
      "name": "如果1",
      "type": "n8n-nodes-base.if",
      "position": [
        2320,
        700
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "43cca0bb-ba0d-49fb-83f4-c702d0bcfc5f",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2500,
        780
      ],
      "webhookId": "8311990f-a70c-41f8-93e3-c623687400fe",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "8ec25c38-dcf5-4213-a9b6-9bbf34b634ed",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        920,
        900
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "1b6da683-0ca9-4f4a-a204-02e638212d81",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -180,
        1120
      ],
      "webhookId": "4cb1a9ff-2beb-480e-9fee-238d1240a70a",
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "28d94341-3be3-434e-a2f3-b2bee2e5efce",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "71fd4459-e05b-4581-af94-2f070e120e59",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "958a13a7-7a0b-415f-877b-96b84f299850",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        560
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f41843fd-e61c-4084-b2a1-29f62a4db7a8",
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Get Video Preview Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Upload Ad Video1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check if finished processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Check if finished processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "settings_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "settings": {
      "main": [
        [
          {
            "node": "Fetch All Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image ": {
      "main": [
        [
          {
            "node": "Upload Second Ad Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "settings_1": {
      "main": [
        [
          {
            "node": "Get Ads to Process",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image 1": {
      "main": [
        [
          {
            "node": "Upload Ad Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Asset": {
      "main": [
        []
      ]
    },
    "Create Image Ad": {
      "main": [
        [
          {
            "node": "Save Image Ad Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video Ad": {
      "main": [
        [
          {
            "node": "Save Video Ad Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Files": {
      "main": [
        [
          {
            "node": "Get Files Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Video or Image Asset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Ad Image": {
      "main": [
        [
          {
            "node": "Check if two or one image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Ad Video": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Ad Video1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract File Specs": {
      "main": [
        [
          {
            "node": "Create Asset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Ads to Process": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Files Metadata": {
      "main": [
        [
          {
            "node": "Extract File Specs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video or Image Asset": {
      "main": [
        [
          {
            "node": "Upload Ad Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get image 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Image Creative": {
      "main": [
        [
          {
            "node": "Create Image Ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Image Ad Details": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Video Ad Details": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Second Ad Image": {
      "main": [
        [
          {
            "node": "Create Multiple Image Creative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video Preview Image": {
      "main": [
        [
          {
            "node": "Create Video Ad Creative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video Ad Creative": {
      "main": [
        [
          {
            "node": "Create Video Ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if two or one image": {
      "main": [
        [
          {
            "node": "Get image ",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Image Creative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Folder Updated": {
      "main": [
        [
          {
            "node": "settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if finished processing": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Multiple Image Creative": {
      "main": [
        [
          {
            "node": "Create Image Ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "settings_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 社交媒体

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流