8
n8n 中文网amn8n.com

Facebook帖子自动化

高级

这是一个Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Code, HttpRequest, Agent, FacebookGraphApi, ChatTrigger 等节点。 使用Gemini和Recraft.ai自动化Facebook中文教学帖子发布

前置要求
  • 可能需要目标 API 的认证凭证
  • Facebook Graph API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "H0lwQeRTWnK9AfTR",
  "meta": {
    "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
    "templateCredsSetupCompleted": true
  },
  "name": "Facebook帖子自动化",
  "tags": [
    {
      "id": "YWorFyHcq8UfkgdY",
      "name": "Social Media Automation",
      "createdAt": "2025-06-11T03:15:35.832Z",
      "updatedAt": "2025-06-11T03:15:35.832Z"
    }
  ],
  "nodes": [
    {
      "id": "cf34bdd0-6e61-41f1-9d71-d44b456fb63e",
      "name": "生成图片(Recraft.ai)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        -592
      ],
      "parameters": {
        "url": "https://external.api.recraft.ai/v1/images/generations",
        "method": "POST",
        "options": {
          "response": {},
          "allowUnauthorizedCerts": true
        },
        "jsonBody": "={\n  \"prompt\": \"{{ $json.output.image_prompt_brief }}\",\n  \"style\": \"digital_illustration\",\n  \"substyle\": \"young_adult_book_2\",\n  \"size\": \"1024x1024\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "ErvYlyGOlyea8toe",
          "name": "Recraft.ai"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1ec91a12-971e-48ff-af77-86a35abd4937",
      "name": "创建FB帖子内容",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        544,
        -592
      ],
      "parameters": {
        "text": "=the word: {{ $json.word }}",
        "options": {
          "systemMessage": "=# ROLE:\nYou are a friendly and knowledgeable Chinese language guru creating viral content for your Thai followers on Facebook. Your persona is like a helpful older friend who makes learning fun and easy. Your goal is to not just teach a word, but to make your followers feel confident using it. \n\n# TASK:\nCreate an engaging and shareable Facebook post to teach a Chinese word. The post must be written primarily in Thai, with Chinese and Pinyin where appropriate. It should be easy to read, visually appealing with emojis, and encourage interaction.\n\n# INPUT:\n1. Thai Word: {thai_meaning or slang}\n2. Chinese Word: {chinese_character}\n3. Pinyin: {pinyin}\n4. Post Ideas : {ideas}\n\n# INSTRUCTIONS & STRUCTURE:\n1. Engaging Hook (ประโยคเปิด):\nStart with a relatable question or a captivating statement in Thai to grab your audience's attention. Make them think, \"Oh, I've always wanted to know how to say that!\"\n\n2. Core Vocabulary (แนะนำคำศัพท์):\nUse the clear and simple format below. Use emojis to make it visually appealing.\n🇨🇳 คำศัพท์ภาษาจีน: [Chinese]\n🗣️ พินอิน (Pinyin): [Pinyin]\n🇹🇭 ความหมาย: [Thai meaning]\n\n3. Real-World Scenarios (ตัวอย่างสถานการณ์จริง):\nProvide at least two different example sentences. Don't just give a dry sentence; frame it as a mini-dialogue or a real-life situation that a Thai person might encounter (e.g., ordering food, shopping, talking with friends, traveling).\nFormat:\nA: [Chinese sentence with the word]\n(Pinyin: [Pinyin for the sentence])\n🇹🇭 Thai Translation: [Thai translation of the sentence]\nB: [A possible reply in Chinese]\n(Pinyin: [Pinyin for the reply])\n🇹🇭 Thai Translation: [Thai translation of the reply]\n\n4. Pro-Tip / Fun Fact (เกร็ดความรู้ / เคล็ดลับ):\nGo beyond a simple fun fact. Offer one of the following:\n4.1 Cultural Insight: How is this word used in a cultural context in China?\n4.2 Common Mistake: Point out a common mistake Thai learners make with this word and how to avoid it.\n4.3 Nuance & Usage: Explain the subtle feeling or specific situation where this word is most appropriate compared to a similar word.\n4.4 Word Breakdown: Briefly explain what the individual characters mean, if it helps with memory (e.g., \"The first character means 'electric' and the second means 'brain', so 'computer' is literally 'electric brain'! 🧠⚡️\").\n\n5. Call to Action & Engagement (ชวนคุย / ปิดท้าย):\nEnd with an open-ended question to encourage comments. For example: \"แล้วเพื่อนๆ เคยใช้คำนี้ในสถานการณ์ไหนกันบ้าง? ลองแต่งประโยคมาแชร์กันใต้คอมเมนต์หน่อยสิคะ! 👇\" (In what situations have you used this word? Try writing a sentence and share it in the comments! 👇)\n\n6. Hashtags (แฮชแท็ก):\nInclude a mix of relevant Thai and English hashtags to increase reach.\nExamples: #เรียนจีน #ภาษาจีน #สอนจีน #เรียนภาษาจีนออนไลน์ #ศัพท์จีน #Chinese #LearnChinese #ภาษาจีนวันละคำ #HSK\n\n# OUTPUT FORMAT:\nReturn your output as a free text to be posted on social media"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "bfd51a8d-be3e-4649-b03e-91cedd8f40f3",
      "name": "结构化输出解析器2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1104,
        -464
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"image_prompt_brief\": \"YOUR_GENERATED_SENTENCE_HERE\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "105e7755-736f-4af6-81d5-09bb0958a5ae",
      "name": "创建图片提示",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        928,
        -592
      ],
      "parameters": {
        "text": "={{ $('Code').item.json.input }}",
        "options": {
          "systemMessage": "=# ROLE:\nYou are a creative concept artist. Your job is to read a social media post and distill its core visual essence into a single, brief sentence.\n\n# INPUT:\nYou will receive an input containing the content of a Facebook post created by the previous agent.\n\n# TASK:\nRead the provided post and generate one brief, descriptive sentence that can be used as a simple prompt for an image generation AI.\n\nYour sentence should:\n1. Capture the main subject, mood, and action of the post.\n2. Be simple, clear, and easy for an image AI to understand.\n3. Do not include technical commands, aspect ratios (--ar), or specific artist names.\n4. Return only 2-3 sentences in plain english word only (no single/doucle quote and any markdown character)\n\n# OUTPUT FORMAT:\nProduce a JSON object with a single key, image_prompt_brief, containing the generated sentence. Try to avoid special characters to the JSON will not error."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "0e3364cb-2bc5-4baf-b25b-89e58689fcc9",
      "name": "图片叠加文字",
      "type": "n8n-nodes-base.httpRequest",
      "disabled": true,
      "position": [
        688,
        432
      ],
      "parameters": {
        "url": "https://api.segmind.com/v1/text-overlay",
        "method": "POST",
        "options": {
          "allowUnauthorizedCerts": true
        },
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "align",
              "value": "right"
            },
            {
              "name": "base64",
              "value": "false"
            },
            {
              "name": "blend_mode",
              "value": "normal"
            },
            {
              "name": "color",
              "value": "#FFF"
            },
            {
              "name": "font",
              "value": "JosefinSans-Bold"
            },
            {
              "name": "font_size",
              "value": "150"
            },
            {
              "name": "graphspace",
              "value": "0"
            },
            {
              "name": "image",
              "value": "={{ $json.data[0].url }}"
            },
            {
              "name": "image_format",
              "value": "jpeg"
            },
            {
              "name": "image_quality",
              "value": "90"
            },
            {
              "name": "linespace",
              "value": "10"
            },
            {
              "name": "margin_x",
              "value": "97"
            },
            {
              "name": "margin_y",
              "value": "300"
            },
            {
              "name": "outline_color",
              "value": "#11ff00"
            },
            {
              "name": "outline_size",
              "value": "0"
            },
            {
              "name": "text",
              "value": "={{ $('Get Thai Word').item.json['Thai Word'] }}"
            },
            {
              "name": "text_underlay",
              "value": "false"
            },
            {
              "name": "wrap",
              "value": "50"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b46a5f5f-69b2-4f03-8add-0e24aa674ab4",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -848
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 640,
        "content": "## 示例帖子"
      },
      "typeVersion": 1
    },
    {
      "id": "875726ce-cc4a-4f14-9c13-884c5c63632f",
      "name": "OpenRouter 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        528,
        -416
      ],
      "parameters": {
        "model": "google/gemini-2.5-pro",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "iQS3GMHjRv36CWYD",
          "name": "n8n Lin"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ec0bfaa3-9cd0-47d2-8e9b-28f15459c60f",
      "name": "OpenRouter 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        912,
        -464
      ],
      "parameters": {
        "model": "google/gemini-flash-1.5",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "iQS3GMHjRv36CWYD",
          "name": "n8n Lin"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3a050584-6eca-4142-9cec-995157ad1527",
      "name": "Facebook Graph API",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1744,
        -592
      ],
      "parameters": {
        "edge": "photos",
        "node": "348151102062182",
        "hostUrl": "=graph.facebook.com",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "message",
                "value": "={{ $('Create FB Post Content').item.json.output }}"
              },
              {
                "name": "url",
                "value": "={{ $json.data[0].url }}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "4wPWgGkeTCce3Yl7",
          "name": "Facebook (Lazy Chinese - Lin n8n App)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "337a556c-0bd6-47d7-8dc3-47b3752eabf2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -768
      ],
      "parameters": {
        "width": 316,
        "height": 440,
        "content": "## Facebook帖子"
      },
      "typeVersion": 1
    },
    {
      "id": "fb1af74d-c403-427a-af21-cb56127e2369",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -112,
        -592
      ],
      "webhookId": "9858f32f-e903-46ee-b5cb-67a063c53f66",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "01efd89a-f09c-4615-82b0-aa563de782dd",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        256,
        -592
      ],
      "parameters": {
        "jsCode": "// Get the value from chatInput\nconst value =  $json.chatInput \n\n// Return the desired structure\nreturn [\n  {\n    json: {\n      word: value,\n      input: value\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "adddd78e-f604-4340-a685-4949460378fa",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -768
      ],
      "parameters": {
        "width": 336,
        "height": 336,
        "content": "## 输入"
      },
      "typeVersion": 1
    },
    {
      "id": "4b0b09cd-d2fd-4843-99fa-01a4f303d35e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -768
      ],
      "parameters": {
        "width": 320,
        "height": 336,
        "content": "## 复制到文字并输入"
      },
      "typeVersion": 1
    },
    {
      "id": "687332b1-a3bb-442e-8c11-1efeafb18e2c",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -768
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 512,
        "content": "## 生成文本"
      },
      "typeVersion": 1
    },
    {
      "id": "5af9aebe-723d-413b-b01b-e1a20b386af0",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -768
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 512,
        "content": "## 描述图片"
      },
      "typeVersion": 1
    },
    {
      "id": "3949bee3-2eb7-4044-afc1-116cd05c40d7",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -768
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 512,
        "content": "## 生成图片"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4c01b471-6ed8-4c13-893f-d597f6702642",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Create FB Post Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Over Image": {
      "main": [
        []
      ]
    },
    "Facebook Graph API": {
      "main": [
        []
      ]
    },
    "Create Image Prompt": {
      "main": [
        [
          {
            "node": "Generate Image (Recraft.ai)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Create FB Post Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create FB Post Content": {
      "main": [
        [
          {
            "node": "Create Image Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Create Image Prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "Create Image Prompt",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image (Recraft.ai)": {
      "main": [
        [
          {
            "node": "Facebook Graph API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流