简单社交:使用 Facebook API 发布 Instagram 单张图片

高级

这是一个Marketing领域的自动化工作流,包含 21 个节点。主要使用 If、Set、EmailSend、ManualTrigger、FacebookGraphApi 等节点。 简单社交:通过 Facebook API 发布 Instagram 单张图片

前置要求
  • Facebook Graph API 凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "OUOrcdfuTg2evIu0",
  "meta": {
    "instanceId": "96b96d0aa1e4ff5d5b6779332b149e3ef3364191562d79083d0309cf3ddfa53e",
    "templateCredsSetupCompleted": true
  },
  "name": "简单社交:使用 Facebook API 发布 Instagram 单张图片",
  "tags": [
    {
      "id": "A0lOPfxLjZ8WmT1S",
      "name": "social",
      "createdAt": "2024-10-25T12:53:04.687Z",
      "updatedAt": "2024-10-25T12:53:04.687Z"
    },
    {
      "id": "jbFbEJV1RM8avhpH",
      "name": "shared on n8n",
      "createdAt": "2024-11-12T06:53:57.894Z",
      "updatedAt": "2024-11-12T06:53:57.894Z"
    }
  ],
  "nodes": [
    {
      "id": "ff1d20ec-2801-4c38-b71f-e0745b22a68c",
      "name": "Instagram 准备媒体",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        0,
        0
      ],
      "parameters": {
        "edge": "media",
        "node": "={{ $json.instagram_business_account_id }}",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "image_url",
                "value": "={{ $json.image_url }}"
              },
              {
                "name": "caption",
                "value": "={{ $json.instagram_post_caption }}"
              }
            ]
          }
        },
        "graphApiVersion": "v20.0",
        "httpRequestMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "ae418ed8-47f7-4042-aa4d-abfbba12c580",
      "name": "Instagram 发布媒体",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        540,
        -80
      ],
      "parameters": {
        "edge": "media_publish",
        "node": "={{ $('Instagram params').item.json.instagram_business_account_id }}",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "creation_id",
                "value": "={{ $json.id }}"
              }
            ]
          }
        },
        "graphApiVersion": "v20.0",
        "httpRequestMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "b4bd1064-606d-4e31-8904-1f86a6f960a1",
      "name": "点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -440,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b0fdc882-298c-4208-9935-d17f86b266dd",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -77.62658687843901
      ],
      "parameters": {
        "height": 248.90655871788812,
        "content": "选择您想要的触发器,例如从另一个工作流触发此工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "c395b60d-2423-415b-a6ef-1ce03c4d55a3",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -51,
        -140.74317176338093
      ],
      "parameters": {
        "color": 4,
        "width": 1329.8249455924943,
        "height": 430.4091991661993,
        "content": "添加您的凭据"
      },
      "typeVersion": 1
    },
    {
      "id": "5e872d97-b19f-4dce-91dc-e18aee3bcdca",
      "name": "Instagram 参数",
      "type": "n8n-nodes-base.set",
      "position": [
        -200,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "225df266-bf29-4415-b04c-2750cef4506a",
              "name": "image_url",
              "type": "string",
              "value": "Your image url"
            },
            {
              "id": "1e380c14-e908-4eeb-90e0-957a422829d0",
              "name": "instagram_business_account_id",
              "type": "string",
              "value": "Your instagram business id"
            },
            {
              "id": "f35e3093-1bff-4cc6-a6c4-909dca314cc7",
              "name": "instagram_post_caption",
              "type": "string",
              "value": "Here your Text of instagram post"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "256566bb-cb69-430e-ac94-ef2fd533f9ef",
      "name": "仅用于检索 Instagram 页面 ID 的节点",
      "type": "n8n-nodes-base.facebookGraphApi",
      "disabled": true,
      "position": [
        -240,
        -360
      ],
      "parameters": {
        "node": "=me",
        "options": {
          "fields": {
            "field": [
              {
                "name": "name"
              },
              {
                "name": "connected_instagram_account"
              }
            ]
          }
        },
        "graphApiVersion": "v20.0"
      },
      "typeVersion": 1
    },
    {
      "id": "52fa439f-a456-4d93-8f1e-b4c4141d32ee",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        -460
      ],
      "parameters": {
        "color": 5,
        "width": 318,
        "height": 289,
        "content": "如果您想检索 Instagram ID,可以使用此节点。"
      },
      "typeVersion": 1
    },
    {
      "id": "2a72a21f-d3d7-4788-978b-8868f50f1108",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -248,
        -140
      ],
      "parameters": {
        "color": 3,
        "width": 188,
        "height": 310,
        "content": "这里我们有发布到 Instagram 的所有参数:图片 URL、标题和 Instagram 商业资料 ID"
      },
      "typeVersion": 1
    },
    {
      "id": "63f6b3b2-4aaa-487c-8eae-e6ed39d77ddc",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        180
      ],
      "parameters": {
        "color": 7,
        "width": 439.10253951549294,
        "height": 792,
        "content": "## 权限"
      },
      "typeVersion": 1
    },
    {
      "id": "336f8d20-ce1c-4097-91ba-1cf7cdd4f8d0",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        -320
      ],
      "parameters": {
        "color": 2,
        "width": 365.0530681548117,
        "height": 232.74275402436496,
        "content": "## 使用 Facebook API 的 Instagram 单张图片发布工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "03ef7207-aa48-4c31-b5c2-91bb2436f68b",
      "name": "Instagram 检查之前上传的媒体状态",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        180,
        0
      ],
      "parameters": {
        "node": "={{ $json.id }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "id"
              },
              {
                "name": "status"
              },
              {
                "name": "status_code"
              }
            ]
          }
        },
        "graphApiVersion": "v20.0"
      },
      "typeVersion": 1
    },
    {
      "id": "3ba33f4a-e89b-40b1-98ec-c658a99777b8",
      "name": "如果媒体状态已完成",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0304efee-33b2-499e-bad1-9238c1fc2999",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status_code }}",
              "rightValue": "FINISHED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fe72d3b7-4a8f-4b2d-9af7-d057da11fc88",
      "name": "Instagram 检查之前发布的媒体状态",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        740,
        -80
      ],
      "parameters": {
        "node": "={{ $('Instagram check status of media uploaded before').item.json.id }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "id"
              },
              {
                "name": "status"
              },
              {
                "name": "status_code"
              }
            ]
          }
        },
        "graphApiVersion": "v20.0"
      },
      "typeVersion": 1
    },
    {
      "id": "4dd7347e-7a41-4cb0-ae2e-93a019ae4497",
      "name": "如果媒体状态已完成1",
      "type": "n8n-nodes-base.if",
      "position": [
        940,
        -80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0304efee-33b2-499e-bad1-9238c1fc2999",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status_code }}",
              "rightValue": "PUBLISHED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7dec948d-7ce0-4a68-acfb-cc9ab8e26f3e",
      "name": "发送邮件",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        540,
        140
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "2c95dafb-f087-45ee-8e1f-3efdacd3ab6c",
      "name": "发送邮件1",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1160,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "c04c8441-6935-4bce-a358-4bba69d5b30b",
      "name": "发送邮件2",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1160,
        40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "74f0c188-03ce-49a6-9004-ee0720f9e4df",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        300
      ],
      "parameters": {
        "color": 3,
        "height": 102.11100456713636,
        "content": "您可以为上传不成功或任何您想要的情况发送邮件,您可以触发另一个工作流或另一个节点"
      },
      "typeVersion": 1
    },
    {
      "id": "127813b3-2cfd-40b9-a4d9-c88c5927f4f1",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1340,
        40
      ],
      "parameters": {
        "color": 3,
        "height": 112.31608359812239,
        "content": "您可以为发布不成功或任何您想要的情况发送邮件,您可以触发另一个工作流或另一个节点"
      },
      "typeVersion": 1
    },
    {
      "id": "f156294d-cf7b-4638-ac00-87ea30f846a0",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1340,
        -120
      ],
      "parameters": {
        "color": 3,
        "height": 112.31608359812239,
        "content": "您可以为成功发布或任何您想要的情况发送邮件,您可以触发另一个工作流或另一个节点"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ea4a1249-35d3-4037-a4f9-451ccc2ec698",
  "connections": {
    "Instagram params": {
      "main": [
        [
          {
            "node": "Instagram prepare media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram prepare media": {
      "main": [
        [
          {
            "node": "Instagram check status of media uploaded before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram publish media": {
      "main": [
        [
          {
            "node": "Instagram check status of media published before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If media status is finished": {
      "main": [
        [
          {
            "node": "Instagram publish media",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If media status is finished1": {
      "main": [
        [
          {
            "node": "Send Email1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Instagram params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram check status of media uploaded before": {
      "main": [
        [
          {
            "node": "If media status is finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram check status of media published before": {
      "main": [
        [
          {
            "node": "If media status is finished1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Edoardo Guzzi

Edoardo Guzzi

@mredodos

Automation expert with 10+ years in programming, AI, Chrome extensions, and mobile apps. Specializing in PHP, JS, and Python, I design custom n8n workflows to streamline processes and boost productivity. Explore my templates or contact me for tailored solutions.

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

分享此工作流