8
n8n 中文网amn8n.com

RSS发布到Facebook和Instagram

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 34 个节点。主要使用 If, Set, Code, Html, Merge 等节点。 通过AI摘要和图像生成自动化RSS到社交媒体发布

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
  • Anthropic API Key
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "R84XmkBzgZQgQPbH",
  "meta": {
    "instanceId": "a244e08ca65e768d1cee097a486ef066f1968b077e055f21a34efe4e78c40e76",
    "templateCredsSetupCompleted": true
  },
  "name": "RSS 发布到 Facebook 和 Instagram",
  "tags": [
    {
      "id": "AOZlNztgqiOQKd6j",
      "name": "n8n Creators",
      "createdAt": "2025-09-28T11:02:15.227Z",
      "updatedAt": "2025-09-28T11:02:15.227Z"
    },
    {
      "id": "ay7TXKzjrY5N4ZmD",
      "name": "Bangla",
      "createdAt": "2025-07-08T20:11:28.278Z",
      "updatedAt": "2025-07-08T20:11:28.278Z"
    }
  ],
  "nodes": [
    {
      "id": "f69c226a-fb49-40eb-8e56-330381747a0d",
      "name": "RSS 源触发器",
      "type": "n8n-nodes-base.rssFeedReadTrigger",
      "position": [
        -3248,
        -640
      ],
      "parameters": {
        "feedUrl": "[INSERT_YOUR_RSS_CHANNEL_URL_HERE]",
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3f91cf1a-9f1e-412f-a0c6-dbc89aff9296",
      "name": "获取表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -3024,
        -640
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.link }}",
              "lookupColumn": "URL"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk/edit#gid=0",
          "cachedResultName": "Arkusz1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk/edit?usp=drivesdk",
          "cachedResultName": "Artykuły RSS"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HNc7xoP7FLMEQ23o",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "b7154b6a-f6df-4f49-b3c8-6660f43a7a08",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -2800,
        -640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5ba488f6-049b-48f0-8ec0-8e97eb3fe90d",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $item(\"0\").$node[\"Get row(s) in sheet\"].json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "01e742d6-6d5d-4b9f-a5d7-67af777a9059",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2576,
        -640
      ],
      "parameters": {
        "url": "={{ $('RSS Feed Trigger').item.json.link }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "48877dcf-d9e7-431b-8d57-1cca347b40e6",
      "name": "HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        -2352,
        -640
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "cssSelector": "*",
              "skipSelectors": "a, img"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d989d9d1-9f63-424e-bf30-bcc6cb73598e",
      "name": "基础 LLM 链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -2128,
        -640
      ],
      "parameters": {
        "text": "={{ $json[''] }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "Step into the role of a technology blog editor. You will receive an article. Your task is to summarize it in 5 sentences. Use the English language. At the end, encourage discussion or comments in a natural way. Skip unnecessary remarks. You may use a maximum of 3 emojis in the entire post. Add the source (name of the service) and 5 hashtags."
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "66784d91-6263-44db-8723-176527cd93aa",
      "name": "在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        -640
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $('RSS Feed Trigger').first().json.link }}",
            "Image URL": "={{ $json.public_image_url }}",
            "FB Post ID": "={{ $json.facebook_post_id }}",
            "FB Post URL": "={{ $json.facebook_post_url }}",
            "Treść posta ": "={{ $('Basic LLM Chain').first().json.text }}",
            "Instagram Post ID": "={{ $json.instagram_post_id }}",
            "Instagram Post URL": "={{ $json.instagram_post_url }}"
          },
          "schema": [
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Treść posta ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Treść posta ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Image URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FB Post URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "FB Post URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FB Post ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "FB Post ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Instagram Post URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Instagram Post URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Instagram Post ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Instagram Post ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk/edit#gid=0",
          "cachedResultName": "Arkusz1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VdLMMjlMb03BhUJHt1q51yG8yJOK0Cvv5pJJa8tBMLk/edit?usp=drivesdk",
          "cachedResultName": "Artykuły RSS"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HNc7xoP7FLMEQ23o",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "4119845f-0a1d-498a-88b2-2a86e357a3df",
      "name": "发布到 Instagram",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -304,
        -544
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/[INSERT_YOUR_SITE_ID]/media",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "={{ $json.public_url }}"
            },
            {
              "name": "caption",
              "value": "={{ $('Basic LLM Chain').item.json.text }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/x-www-form-urlencoded"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YliEbZCZWU3Hizi4",
          "name": "Facebook Graph AKTUALNY"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "189295a3-794c-4171-ad92-e13efad5789d",
      "name": "发布到 Instagram1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        -544
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/[INSERT_YOUR_SITE_ID]/media_publish",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/x-www-form-urlencoded"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YliEbZCZWU3Hizi4",
          "name": "Facebook Graph AKTUALNY"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f7764612-2c59-4015-9841-acf33026e825",
      "name": "获取帖子 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        -544
      ],
      "parameters": {
        "url": "={{ `https://graph.facebook.com/${$json.fbApiVersion || 'v19.0'}/${$json.id}?fields=permalink` }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YliEbZCZWU3Hizi4",
          "name": "Facebook Graph AKTUALNY"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a4383011-8e48-46ef-8094-cc656b6eccc0",
      "name": "发送照片消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1264,
        -640
      ],
      "webhookId": "b91ccd44-0556-4582-bf42-f338737efbc4",
      "parameters": {
        "file": "={{ $json['Image URL'] }}",
        "chatId": "=1187348254",
        "operation": "sendPhoto",
        "additionalFields": {
          "caption": "=New post published!\n\nFacebooka Link:\n{{ $json['FB Post URL'] }}\nInstagram Link:\n{{ $json['Instagram Post URL'] }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "0182R0Ur9p3JWSfZ",
          "name": "SmartCamp.AI Social Media Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cbee4ab0-e47f-4543-be38-1f748d88142b",
      "name": "基础LLM链1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1776,
        -640
      ],
      "parameters": {
        "text": "=Generate a prompt for Open AI Image Generation to create a professional image for social media (Facebook, Instagram) on this TOPIC: {{ $json.text }}. The image should be engaging, suitable for a technology blog, for example photorealistic shots of experts in the office, in the field, photos of specific devices, technologies, or concepts described in the article. The images should be aesthetic and evoke positive feelings. The subject and appearance of the image must be closely related to the given TOPIC. Remember, this is a prompt that will later be pasted into the body in the API, so avoid elements that may break the JSON (you cannot use quotation marks). Generate only the prompt, without introduction, without quotation marks. The entire message must be less than 1000 characters.",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "38b9755e-5f67-4a43-aebf-a6445f0cf488",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -2064,
        -416
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "sOnoKEVS37DZ4otg",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b86f044c-4183-4d33-998c-587c9079e1c3",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1712,
        -416
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Rrs7dei8RtxmvU6n",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8b1284be-d6df-4578-9847-fcf58662870f",
      "name": "发布到 Facebook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -288,
        -768
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/[INSERT_YOUR_SITE_ID]/photos",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "caption",
              "value": "={{ $('Basic LLM Chain').item.json.text }} \n\nŹródło: {{ $('RSS Feed Trigger').item.json.link }}"
            },
            {
              "name": "=url",
              "value": "={{ $json.public_url }}"
            },
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/x-www-form-urlencoded"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "YliEbZCZWU3Hizi4",
          "name": "Facebook Graph AKTUALNY"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9b6166e7-caff-439e-9fb1-a28ef9296090",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        592,
        -640
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "c6d0cbd6-cbed-458a-a630-804b1fe34ca8",
      "name": "发送短信",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1488,
        -640
      ],
      "webhookId": "93dd7833-b953-4dd8-abdc-b1ff22ccd7b2",
      "parameters": {
        "text": "=Original article:\n{{ $('RSS Feed Trigger').first().json.title }}\n{{ $('RSS Feed Trigger').first().json.link }}\n\n\nPost Content:\n\n{{ $('Basic LLM Chain').first().json.text }}\n",
        "chatId": "1187348254",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "0182R0Ur9p3JWSfZ",
          "name": "SmartCamp.AI Social Media Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ec53d477-6b08-4bb9-9db4-13d566013d2c",
      "name": "生成图片",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1424,
        -640
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "={{ $json.text }}",
        "options": {
          "size": "1024x1024",
          "quality": "high"
        },
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "id": "1rHbxq7xrWlOZ6zj",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f1818d78-9245-46d3-b338-c13d14b7f396",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -1200,
        -640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bb4004a1-9c8b-4603-b8ed-227e50940f87",
              "name": "filename",
              "type": "string",
              "value": "={{$now.toMillis()}}.png"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "f20e1497-7241-4c54-8b17-057050fc2e06",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3296,
        -752
      ],
      "parameters": {
        "width": 176,
        "height": 272,
        "content": "## RSS 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "2039fdb6-004b-404e-b09f-5b32add81dfe",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3056,
        -752
      ],
      "parameters": {
        "width": 384,
        "height": 272,
        "content": "## 内容过滤"
      },
      "typeVersion": 1
    },
    {
      "id": "299eddc0-de9d-4fea-a4de-96ed7a4f9c79",
      "name": "上传到 Supabase(使用凭据)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -752,
        -640
      ],
      "parameters": {
        "url": "={{ ($json.supabase_base_url || '').trim().replace(/\\/+$/,'') + '/storage/v1/object/' + ($json.bucket || 'social-media-ai-generated') + '/' + $json.filename }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "content-type",
              "value": "=={{ $binary.data?.mimeType || 'application/octet-stream' }}"
            },
            {
              "name": "x-upsert",
              "value": "true"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "supabaseApi"
      },
      "credentials": {
        "supabaseApi": {
          "id": "xNNUVvVXkkEjNATa",
          "name": "Supabase account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "54d2a31b-ef8b-4ea6-a900-519170db3876",
      "name": "Supabase 配置",
      "type": "n8n-nodes-base.set",
      "position": [
        -976,
        -640
      ],
      "parameters": {
        "options": {
          "stripBinary": false
        },
        "assignments": {
          "assignments": [
            {
              "id": "1dbcf7c4-2e01-4df2-874e-93868b74a519",
              "name": "bucket",
              "type": "string",
              "value": "[INSERT_THE_NAME_OF_YOUR_BUCKET]"
            },
            {
              "id": "4e88d63f-01de-4265-8271-fd0ed637b5fd",
              "name": "filename",
              "type": "string",
              "value": "={{ $json.filename }}"
            },
            {
              "id": "b5579b42-bc9e-44d9-b997-2f1e505c0692",
              "name": "link_ttl_seconds",
              "type": "string",
              "value": "3600"
            },
            {
              "id": "ab260017-3161-4cbf-ad86-84d23a94e780",
              "name": "supabase_base_url",
              "type": "string",
              "value": "[INSERT_YOUR_SUPABASE_URL]"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "32b6f415-a837-4783-a76c-795276d3c4e4",
      "name": "Supabase 公共 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -528,
        -640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cdc9fb52-3d91-4af4-9ff4-8fb15e6543c4",
              "name": "public_url",
              "type": "string",
              "value": "={{ $node[\"Supabase Config\"].json.supabase_base_url.toString().trim().replace(/\\/+$/,'') + \"/storage/v1/object/public/\" + encodeURIComponent($node[\"Supabase Config\"].json.bucket) + \"/\" + encodeURIComponent($node[\"Supabase Config\"].json.filename) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "57519156-2fe8-4f0b-8841-968eeeb443ca",
      "name": "图像处理管道",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -752
      ],
      "parameters": {
        "width": 888,
        "height": 268,
        "content": "## 将图像保存到 Supabase"
      },
      "typeVersion": 1
    },
    {
      "id": "a1eda551-4d5f-4504-97bb-c4186366e10f",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2592,
        -752
      ],
      "parameters": {
        "width": 384,
        "height": 272,
        "content": "## 文本提取"
      },
      "typeVersion": 1
    },
    {
      "id": "b5691de0-99a5-401a-9972-603e0f38aaf9",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        -752
      ],
      "parameters": {
        "width": 320,
        "height": 480,
        "content": "## 帖子生成"
      },
      "typeVersion": 1
    },
    {
      "id": "68990808-cec4-46fd-ae73-ea4c2045dce9",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1824,
        -752
      ],
      "parameters": {
        "width": 528,
        "height": 480,
        "content": "## 图像生成"
      },
      "typeVersion": 1
    },
    {
      "id": "bc9b5229-bbe2-49a4-840f-d2fd9c38b5a6",
      "name": "构建 Facebook URL",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        -736
      ],
      "parameters": {
        "jsCode": "// Pobierz post_id prosto z node 'Post to Facebook'\nconst post_id = $node[\"Post to Facebook\"].json.post_id || '';\n\n// Twój username/slug strony FB\nconst facebookUsername = 'SmartCampAI';\n\n// Wyciągnij tylko właściwy postId (po podkreślniku, jeśli występuje)\nconst parts = post_id.split('_');\nconst postId = parts.length > 1 ? parts[1] : post_id;\n\n// Buduj link\nconst facebookPostUrl = postId\n  ? `https://facebook.com/${facebookUsername}/posts/${postId}`\n  : '';\n\nreturn {\n  json: {\n    facebook_post_id: postId,\n    facebook_post_url: facebookPostUrl,\n    facebook_published: !!postId\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "3cb5a6d0-dada-4485-bce7-88ef3fb7b4da",
      "name": "构建 Instagram URL",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        -544
      ],
      "parameters": {
        "jsCode": "const mediaId = $json.id || '';\nreturn {\n  json: {\n    instagram_post_id: mediaId,\n    instagram_post_url: $input.first().json.permalink, // nie mamy shortcode :(\n    instagram_published: !!mediaId\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "da68cf9b-f4ef-417b-9747-a5a98a535e72",
      "name": "收集重要数据",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        -640
      ],
      "parameters": {
        "jsCode": "// Bezpieczny getter do $()\n// Zwraca { json: {} } gdy node nie istnieje lub nie ma danych\nfunction pickNodeFirst(name) {\n  try {\n    const arr = $(name).all();\n    if (Array.isArray(arr) && arr.length > 0) return arr[0];\n  } catch (e) {\n    // node nie istnieje – zwróć pusty obiekt, żeby nie wywalić wykonania\n  }\n  return { json: {} };\n}\n\nfunction safeGet(obj, path, def = null) {\n  try {\n    const parts = Array.isArray(path) ? path : String(path).split('.');\n    return parts.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : def), obj);\n  } catch {\n    return def;\n  }\n}\n\n// Skróty do node’ów (UŻYJ DOKŁADNYCH NAZW)\nconst fb   = pickNodeFirst('Build Facebook URL');\nconst insta= pickNodeFirst('Build Instagram URL');\nconst llm  = pickNodeFirst('Basic LLM Chain');\nconst rss  = pickNodeFirst('RSS Feed Trigger');\nconst pub  = pickNodeFirst('Supabase Public URL'); // <-- poprawiona nazwa\n\nreturn [\n  {\n    json: {\n      facebook_post_id:   safeGet(fb,   ['json','facebook_post_id'],   null),\n      facebook_post_url:  safeGet(fb,   ['json','facebook_post_url'],  null),\n      facebook_published: safeGet(fb,   ['json','published'],          false),\n\n      instagram_post_id:  safeGet(insta,['json','instagram_post_id'],  null),\n      instagram_post_url: safeGet(insta,['json','instagram_post_url'], null),\n      instagram_published:safeGet(insta,['json','published'],          false),\n\n      caption:            safeGet(llm,  ['json','caption'],            null),\n      title:              safeGet(rss,  ['json','title'],              null),\n\n      public_image_url:   safeGet(pub,  ['json','public_url'],   null) // URL z Supabase\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "b612862f-f41c-42ef-9691-65de8f59d93f",
      "name": "图像处理管道1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -944
      ],
      "parameters": {
        "width": 888,
        "height": 556,
        "content": "# 发布到 Facebook 和 Instagram"
      },
      "typeVersion": 1
    },
    {
      "id": "d5acbcda-aa09-4b0a-98e4-45cdb6cd1f49",
      "name": "图像处理管道2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -864
      ],
      "parameters": {
        "width": 648,
        "height": 412,
        "content": "# 收集和组织数据"
      },
      "typeVersion": 1
    },
    {
      "id": "a242af6a-6b20-4051-a5ad-736c76ff8559",
      "name": "图像处理管道3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        -864
      ],
      "parameters": {
        "width": 472,
        "height": 412,
        "content": "# 通过 Telegram 发送报告"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6fbcafe1-f983-4a9a-95c6-df50b6ce31d5",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Collect Important Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Supabase Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Post URL": {
      "main": [
        [
          {
            "node": "Build Instagram URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Config": {
      "main": [
        [
          {
            "node": "Upload to Supabase (uses credentials)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain1": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Facebook": {
      "main": [
        [
          {
            "node": "Build Facebook URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS Feed Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Instagram": {
      "main": [
        [
          {
            "node": "Post to Instagram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Facebook URL": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Instagram1": {
      "main": [
        [
          {
            "node": "Get Post URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Send a photo message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Instagram URL": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Public URL": {
      "main": [
        [
          {
            "node": "Post to Instagram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send a photo message": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Important Data": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Supabase (uses credentials)": {
      "main": [
        [
          {
            "node": "Supabase Public URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流