Instagram Reels 自动化

高级

这是一个AI领域的自动化工作流,包含 21 个节点。主要使用 Code、Wait、Airtable、GoogleDrive、HttpRequest 等节点,结合人工智能技术实现智能自动化。 简化的内容创建与发布 Instagram Reels 自动化

前置要求
  • Airtable API Key
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Facebook Graph API 凭证
  • Google Gemini API Key

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "67849de66331aaa2dca6a4f3cbf793b274f923d94e4d9cdaae2e5d9aebaff626",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e56fcbb9-2ede-4fa0-91b1-565b41e45ec9",
      "name": "Google Drive 文件夹中的帖子文件上传触发器",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -860,
        -640
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 1
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_FOLDER_ID",
          "cachedResultName": "n8n reels automation on instagram"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CREDENTIAL_ID",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "14f7c794-938e-4c19-ba7d-9df7c8db2713",
      "name": "N8N 中的帖子文件下载 (Google Drive 节点)",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -500,
        -280
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CREDENTIAL_ID",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "8edf7ec7-06c5-47f5-8f35-e294af1256df",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -420,
        180
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "YOUR_GOOGLE_GEMINI_CREDENTIAL_ID",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1f09b5fc-331b-4914-9b2f-598f5a492722",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -140,
        -680
      ],
      "parameters": {
        "text": "=Generate an engaging Instagram caption for a video titled \"{{ $json.processedFileName }}\".\n\nHere's what to include:\n- 2-3 engaging sentences with appropriate emojis.\n- 3-5 relevant hashtags based on the video title.\n- A clear call-to-action encouraging comments.\n\nPlease keep the total caption under 150 characters.\n\nYou are skilled at writing clear, engaging, and detailed captions based on just a file name. Help viewers understand and appreciate the post. The tone should be relatable and suitable for an Instagram audience. Avoid using too many whimsical words or excessive adjectives. Focus on encouraging people to connect with the post and respond in the comments.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "4289ddbe-71f0-49bb-98e8-fbe0899f4ad4",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        260,
        -660
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_AIRTABLE_BASE_ID",
          "cachedResultUrl": "https://airtable.com/YOUR_AIRTABLE_BASE_ID",
          "cachedResultName": "IG reels"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_AIRTABLE_TABLE_ID",
          "cachedResultUrl": "https://airtable.com/YOUR_AIRTABLE_BASE_ID/YOUR_AIRTABLE_TABLE_ID",
          "cachedResultName": "Table 1"
        },
        "columns": {
          "value": {
            "URL": "={{ $('Code').item.json.processedWebContentLink }}",
            "Name": "={{ $('Code').item.json.processedFileName }}",
            "Caption": "={{ $json.output }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "YOUR_AIRTABLE_CREDENTIAL_ID",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b7c45adb-ae7e-4497-b261-e37b0437a70c",
      "name": "容器",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        540,
        -560
      ],
      "parameters": {
        "edge": "media",
        "node": "YOUR_FACEBOOK_PAGE_ID",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "video_url",
                "value": "={{ $json.fields.URL }}"
              },
              {
                "name": "media_type",
                "value": "REELS"
              },
              {
                "name": "caption",
                "value": "={{ $('AI Agent').item.json.output }}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YOUR_FACEBOOK_GRAPH_CREDENTIAL_ID",
          "name": "Facebook Graph account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "80ba05f1-127d-4a79-9be7-d05f13287568",
      "name": "发布到 IG",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1060,
        -380
      ],
      "parameters": {
        "edge": "media_publish",
        "node": "YOUR_FACEBOOK_PAGE_ID",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "creation_id",
                "value": "={{ $json.id }}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YOUR_FACEBOOK_GRAPH_CREDENTIAL_ID",
          "name": "Facebook Graph account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cdcef117-9334-4683-90a1-cdd6a3608bc8",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        40,
        120
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Post File Download in N8N (Google Drive Node)').item.json.webViewLink }}"
        },
        "options": {},
        "operation": "deleteFile"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CREDENTIAL_ID",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "795dcd70-54d4-4e99-9336-0575b2e4fe41",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        780,
        -460
      ],
      "webhookId": "YOUR_WEBHOOK_ID",
      "parameters": {
        "amount": 90
      },
      "typeVersion": 1.1
    },
    {
      "id": "fa82e952-e230-4d3a-9cd2-97bf59747a3d",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        120,
        -140
      ],
      "webhookId": "YOUR_WEBHOOK_ID",
      "parameters": {
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "57e21bda-91ec-4061-bc9a-1cbb47d4ce74",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        -320,
        -380
      ],
      "parameters": {
        "jsCode": "// Code (Function) Node Script - Focused on Input Debugging\nconst inputItem = items[0]; // Get the whole item, not just .json yet\n\n// Log the entire incoming item to see its structure, including binary properties if any\nconsole.log(\"Full Input Item to Code Node:\", JSON.stringify(inputItem, null, 2));\n\nconst itemJson = inputItem.json; // Now get the JSON part\n\nlet fileId;\nlet fileName;\nlet webContentLink;\n\nif (typeof itemJson !== 'object' || itemJson === null) {\n    console.error(\"Input item.json is not an object or is null. Input was:\", JSON.stringify(inputItem, null, 2));\n    fileName = \"Unknown Video (Input not an object)\";\n} else {\n    // Try to access properties directly, assuming Google Drive File Resource structure\n    fileId = itemJson.id;\n    fileName = itemJson.name;\n    webContentLink = itemJson.webContentLink || itemJson.webViewLink; // Fallback to webViewLink\n\n    console.log(`Attempting to extract: id='${fileId}', name='${fileName}', webContentLink='${webContentLink}'`);\n\n    if (typeof fileName !== 'string' || fileName.trim() === \"\") {\n        console.warn(\"fileName is missing or invalid in Code Node input. Actual item.json.name was:\", itemJson.name, \". Setting to 'Unknown Video'.\");\n        fileName = \"Unknown Video\";\n    } else {\n        console.log(\"Successfully extracted fileName:\", fileName);\n    }\n\n    if (typeof fileId !== 'string' || fileId.trim() === \"\") {\n        console.warn(\"fileId is missing or invalid.\");\n        // fileId remains as extracted or undefined\n    }\n\n    if (typeof webContentLink !== 'string' || webContentLink.trim() === \"\") {\n        console.warn(\"webContentLink (and webViewLink) is missing or invalid.\");\n        // webContentLink remains as extracted or undefined\n    }\n}\n\nconst outputData = {\n  processedFileId: fileId,\n  processedFileName: fileName,\n  processedWebContentLink: webContentLink\n};\n\nconsole.log(\"Output from Code Node:\", JSON.stringify(outputData, null, 2));\n\n// Return structure expected by n8n\nreturn [{ json: outputData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d5a8af48-f6da-46d6-aa9a-9307c426f9c9",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1240,
        -380
      ],
      "parameters": {
        "url": "https://www.googleapis.com/drive/v3/files",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "'YOUR_RANDOM_VIDEO_SOURCE_FOLDER_ID' in parents and mimeType='video/mp4' and trashed=false"
            },
            {
              "name": "fields",
              "value": "files(id, name, mimeType, parents)"
            },
            {
              "name": "supportsAllDrives",
              "value": "true"
            },
            {
              "name": "includeItemsFromAllDrives",
              "value": "true"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CREDENTIAL_ID",
          "name": "Google account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b6b7630c-cf14-4318-9bb8-fc67750805db",
      "name": "HTTP 请求 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1240,
        100
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/drive/v3/files/{{ $json.id }}",
        "method": "PATCH",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "addParents",
              "value": "YOUR_FOLDER_ID"
            },
            {
              "name": "removeParents",
              "value": "YOUR_RANDOM_VIDEO_SOURCE_FOLDER_ID"
            },
            {
              "name": "fields",
              "value": "id,name,parents,webContentLink,webViewLink,mimeType"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CREDENTIAL_ID",
          "name": "Google account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "db8fd564-37e0-47f8-81ab-8bac592df96c",
      "name": "计划触发器1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1260,
        -620
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4c78b24d-f9be-4db9-ab8a-8ca064865911",
      "name": "代码1",
      "type": "n8n-nodes-base.code",
      "position": [
        -1240,
        -160
      ],
      "parameters": {
        "jsCode": "const responseData = items[0].json;\n\nif (!responseData || !responseData.files || responseData.files.length === 0) {\n  console.warn(\"No files found in the source Google Drive folder via API or API response was unexpected.\");\n  return [];\n}\n\nconst filesArray = responseData.files;\nconst randomIndex = Math.floor(Math.random() * filesArray.length);\nconst randomFile = filesArray[randomIndex];\n\nreturn [{ json: randomFile }];"
      },
      "typeVersion": 2
    },
    {
      "id": "a4d882e1-93bc-4647-8222-0a1a9519e1f0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -380
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 720,
        "content": "## 等待 20 秒然后触发 Instagram 发布工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "a75eab91-cb94-42b2-b8aa-491bcaadc2bf",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1400,
        -800
      ],
      "parameters": {
        "width": 420,
        "height": 1140,
        "content": "## 随机文件移动器"
      },
      "typeVersion": 1
    },
    {
      "id": "ea0150fd-e301-4d4a-aaa7-69124b1aa624",
      "name": "等待2",
      "type": "n8n-nodes-base.wait",
      "position": [
        -840,
        -60
      ],
      "webhookId": "YOUR_WEBHOOK_ID",
      "parameters": {
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "50f581c6-f8f1-4967-91a4-2a636eaffb1c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -800
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 420,
        "content": "## 手动上传触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "f312023b-cb76-415c-945b-732b534a6b6e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -800
      ],
      "parameters": {
        "color": 4,
        "width": 1880,
        "height": 1140,
        "content": "## Instagram 上传器"
      },
      "typeVersion": 1
    },
    {
      "id": "e37c99b4-1393-4978-91e5-84e999f40e2e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -880
      ],
      "parameters": {
        "color": 6,
        "width": 2920,
        "height": 1320,
        "content": "## Instagram 自动化工作流....."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "Schedule Trigger1": [
      {
        "Hour": "18",
        "Year": "2025",
        "Month": "June",
        "Minute": "00",
        "Second": "26",
        "Timezone": "Asia/Kolkata (UTC+05:30)",
        "timestamp": "2025-06-18T18:00:26.006+05:30",
        "Day of week": "Wednesday",
        "Day of month": "18",
        "Readable date": "June 18th 2025, 6:00:26 pm",
        "Readable time": "6:00:26 pm"
      }
    ]
  },
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Post to IG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Post File Download in N8N (Google Drive Node)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "container": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to IG": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Post File Download in N8N (Google Drive Node)": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post File Upload in Google Drive Folder  Trigger": {
      "main": [
        [
          {
            "node": "Post File Download in N8N (Google Drive Node)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

外部链接
在 n8n.io 上查看 →

分享此工作流