8
n8n 中文网amn8n.com

使用 Notion 和 GPT-4 的 SNS 自动发布器(Instagram 自动发布 + Threads/X/博客草稿)

高级

这是一个Miscellaneous, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Notion, Webhook, HttpRequest, OpenAi 等节点。 使用 GPT-4、Notion 和 Instagram API 自动生成并发布社交媒体内容

前置要求
  • Notion API Key
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "A90U504fcvjJqgF5",
  "meta": {
    "instanceId": "ad59d09d8e026d0e92690243618d86d51b0293b236148394ca356eae1d1ea59b"
  },
  "name": "使用Notion和GPT-4的SNS自动发布器(Instagram自动发布 + Threads/X/博客草稿)",
  "tags": [],
  "nodes": [
    {
      "id": "feef23dc-de7b-426f-9e86-26e3ba755c16",
      "name": "步骤1:输入",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -64
      ],
      "parameters": {
        "width": 464,
        "height": 448,
        "content": "# 步骤1:输入"
      },
      "typeVersion": 1
    },
    {
      "id": "a58fb4c9-73e7-486b-aaa4-8bb537c63117",
      "name": "步骤2:生成标题",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -64
      ],
      "parameters": {
        "color": 3,
        "width": 2224,
        "height": 448,
        "content": "# 步骤2:生成标题"
      },
      "typeVersion": 1
    },
    {
      "id": "60353fc8-ea55-46a6-af74-744ff9bc99cf",
      "name": "步骤3:图像处理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2416,
        -64
      ],
      "parameters": {
        "color": 4,
        "width": 416,
        "height": 448,
        "content": "# 步骤3:图像处理"
      },
      "typeVersion": 1
    },
    {
      "id": "d6e2fe83-ee28-4917-962b-7d3eff5e3be7",
      "name": "步骤4:Instagram发布",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2864,
        -64
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 448,
        "content": "# 步骤4:Instagram发布"
      },
      "typeVersion": 1
    },
    {
      "id": "77eac861-c22d-46b9-b321-91f275c7e2a9",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "notes": "Receive text input (from LINE or other source).",
      "position": [
        -288,
        160
      ],
      "webhookId": "d00a0c29-6e20-47f7-b57a-c60ed357c486",
      "parameters": {
        "path": "line-book-output",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "=onReceived"
      },
      "typeVersion": 2
    },
    {
      "id": "d9caab24-f532-455a-b19d-d9cff6dc1fe1",
      "name": "创建Notion页面",
      "type": "n8n-nodes-base.notion",
      "notes": "Create a new Notion page with input text.",
      "position": [
        -64,
        160
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": "<your_database_id>",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Title|title",
              "textContent": "={{ $json.body.events[0].message.text }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bf244b57-2dcf-4232-9460-e77c882d5982",
      "name": "生成Instagram标题",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "notes": "Generate Instagram caption using GPT-4.",
      "position": [
        160,
        160
      ],
      "parameters": {
        "modelId": {
          "mode": "list",
          "value": "chatgpt-4o-latest"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Summarize for Instagram (<=1000 chars, include hashtags):\n{{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f10bfbfa-031b-4299-b4d4-f91707ced60c",
      "name": "保存Instagram标题",
      "type": "n8n-nodes-base.notion",
      "position": [
        512,
        160
      ],
      "parameters": {
        "pageId": {
          "mode": "url",
          "value": "={{ $('Notion Page Create').item.json.url }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Instagram Caption|rich_text",
              "textContent": "={{ $json.message.content }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2f1034e6-61fc-4c78-adfd-dd4d02b8dbe5",
      "name": "生成Threads标题",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        736,
        160
      ],
      "parameters": {
        "modelId": {
          "mode": "list",
          "value": "chatgpt-4o-latest"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Summarize for Threads (<=500 chars, include hashtags):\n{{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "7d9b7435-1580-40fb-8b4d-e3e9fa1364fe",
      "name": "保存Threads标题",
      "type": "n8n-nodes-base.notion",
      "position": [
        1088,
        160
      ],
      "parameters": {
        "pageId": {
          "mode": "url",
          "value": "={{ $('Notion Page Create').item.json.url }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Threads Caption|rich_text",
              "textContent": "={{ $json.message.content }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e71cc3dd-4c56-46f5-b590-8a6bab4c33b7",
      "name": "生成X标题",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1312,
        160
      ],
      "parameters": {
        "modelId": {
          "mode": "list",
          "value": "chatgpt-4o-latest"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Summarize for X/Twitter (<=280 chars, include hashtags):\n{{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "d9ed8fd0-cfa5-4e3f-84b8-b4c45d5ada00",
      "name": "保存X标题",
      "type": "n8n-nodes-base.notion",
      "position": [
        1664,
        160
      ],
      "parameters": {
        "pageId": {
          "mode": "url",
          "value": "={{ $('Notion Page Create').item.json.url }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "X Caption|rich_text",
              "textContent": "={{ $json.message.content }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bb04cea6-8bfe-4167-a688-74f0b56bdef8",
      "name": "生成博客草稿",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1888,
        160
      ],
      "parameters": {
        "modelId": {
          "mode": "list",
          "value": "chatgpt-4o-latest"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Rewrite into blog article (<=1800 chars, include Title, TOC, Body):\n{{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "ba0f53a5-ac72-4fc6-925e-8bee44e32b32",
      "name": "保存博客草稿",
      "type": "n8n-nodes-base.notion",
      "position": [
        2240,
        160
      ],
      "parameters": {
        "pageId": {
          "mode": "url",
          "value": "={{ $('Notion Page Create').item.json.url }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Blog Draft|rich_text",
              "textContent": "={{ $json.message.content }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "813fdc45-f135-4f91-a35a-7711f86de3f4",
      "name": "上传到Cloudinary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2464,
        160
      ],
      "parameters": {
        "url": "https://api.cloudinary.com/v1_1/<your_cloud_name>/image/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data1"
            },
            {
              "name": "folder",
              "value": "ig/books"
            },
            {
              "name": "public_id",
              "value": "=ig_books_{{ $json.isbn13 || Date.now() }}_cover"
            },
            {
              "name": "upload_preset",
              "value": "<your_upload_preset>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "74721ffb-a236-4fdf-b4c0-23745f357c65",
      "name": "Instagram媒体容器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2688,
        160
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/17841458946648987/media",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "={{$env.IG_ACCESS_TOKEN}}"
            },
            {
              "name": "image_url",
              "value": "={{$('Upload to Cloudinary').item.json.secure_url}}"
            },
            {
              "name": "caption",
              "value": "={{ $('Instagram Caption Save').item.json[\"Instagram Caption|rich_text\"][0].plain_text }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9e25da48-1164-4b10-94c7-2108cdbd67ff",
      "name": "Instagram发布",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2992,
        160
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/17841458946648987/media_publish",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $('Instagram Media Container').item.json.id }}"
            },
            {
              "name": "access_token",
              "value": "={{$env.IG_ACCESS_TOKEN}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "840dc1ba-d065-490f-85da-563e46ebe80d",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Notion Page Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "X Caption Save": {
      "main": [
        [
          {
            "node": "Blog Draft Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Blog Draft Save": {
      "main": [
        [
          {
            "node": "Upload to Cloudinary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion Page Create": {
      "main": [
        [
          {
            "node": "Instagram Caption Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "X Caption Generate": {
      "main": [
        [
          {
            "node": "X Caption Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Blog Draft Generate": {
      "main": [
        [
          {
            "node": "Blog Draft Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Threads Caption Save": {
      "main": [
        [
          {
            "node": "X Caption Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Cloudinary": {
      "main": [
        [
          {
            "node": "Instagram Media Container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Caption Save": {
      "main": [
        [
          {
            "node": "Threads Caption Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Threads Caption Generate": {
      "main": [
        [
          {
            "node": "Threads Caption Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Media Container": {
      "main": [
        [
          {
            "node": "Instagram Publish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Caption Generate": {
      "main": [
        [
          {
            "node": "Instagram Caption Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 杂项, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流