Facebook帖子自动化
高级
这是一个Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Code, HttpRequest, Agent, FacebookGraphApi, ChatTrigger 等节点。 使用Gemini和Recraft.ai自动化Facebook中文教学帖子发布
前置要求
- •可能需要目标 API 的认证凭证
- •Facebook Graph API 凭证
使用的节点 (17)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "H0lwQeRTWnK9AfTR",
"meta": {
"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
"templateCredsSetupCompleted": true
},
"name": "Facebook Post Automation",
"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": "Generate Image (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": "Create FB Post Content",
"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": "Structured Output Parser2",
"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": "Create Image Prompt",
"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": "Text Over Image",
"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": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-656,
-848
],
"parameters": {
"color": 7,
"width": 360,
"height": 640,
"content": "## Sample Post\n\n\n\n\n"
},
"typeVersion": 1
},
{
"id": "875726ce-cc4a-4f14-9c13-884c5c63632f",
"name": "OpenRouter Chat Model",
"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 Chat Model1",
"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": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1632,
-768
],
"parameters": {
"width": 316,
"height": 440,
"content": "## Facebook Post\n\nUse Facebook Graph API to post both text and image in the same post\nhttps://developers.facebook.com/docs/pages-api/posts#publish-a-photo\n"
},
"typeVersion": 1
},
{
"id": "fb1af74d-c403-427a-af21-cb56127e2369",
"name": "When chat message received",
"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": "Code",
"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": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-768
],
"parameters": {
"width": 336,
"height": 336,
"content": "## Input\n\nThe input here is from the chat message below. However, please feel free to replace it with GoogleSheet of plan or Email input or anything that works for you."
},
"typeVersion": 1
},
{
"id": "4b0b09cd-d2fd-4843-99fa-01a4f303d35e",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
144,
-768
],
"parameters": {
"width": 320,
"height": 336,
"content": "## Copy it to words and input\n\nBecause sometimes the route of n8n will delete the content used earlier, we explicitly split it into 2 variables"
},
"typeVersion": 1
},
{
"id": "687332b1-a3bb-442e-8c11-1efeafb18e2c",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
496,
-768
],
"parameters": {
"color": 4,
"width": 320,
"height": 512,
"content": "## Generate Text\n\nUse Openrouter.ai to write the content for Facebook from the input word we've got"
},
"typeVersion": 1
},
{
"id": "5af9aebe-723d-413b-b01b-e1a20b386af0",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-768
],
"parameters": {
"color": 6,
"width": 336,
"height": 512,
"content": "## Describe Image\n\nUse AI to describe the words so that we can use this as input to generate image. We make sure it structured so that the API call will not break."
},
"typeVersion": 1
},
{
"id": "3949bee3-2eb7-4044-afc1-116cd05c40d7",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1232,
-768
],
"parameters": {
"color": 6,
"width": 336,
"height": 512,
"content": "## Generate Image\n\nUsing Recraft.ai with specified styled to make sure we have consistent image theme."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "4c01b471-6ed8-4c13-893f-d597f6702642",
"connections": {
"01efd89a-f09c-4615-82b0-aa563de782dd": {
"main": [
[
{
"node": "1ec91a12-971e-48ff-af77-86a35abd4937",
"type": "main",
"index": 0
}
]
]
},
"0e3364cb-2bc5-4baf-b25b-89e58689fcc9": {
"main": [
[]
]
},
"3a050584-6eca-4142-9cec-995157ad1527": {
"main": [
[]
]
},
"105e7755-736f-4af6-81d5-09bb0958a5ae": {
"main": [
[
{
"node": "cf34bdd0-6e61-41f1-9d71-d44b456fb63e",
"type": "main",
"index": 0
}
]
]
},
"875726ce-cc4a-4f14-9c13-884c5c63632f": {
"ai_languageModel": [
[
{
"node": "1ec91a12-971e-48ff-af77-86a35abd4937",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"1ec91a12-971e-48ff-af77-86a35abd4937": {
"main": [
[
{
"node": "105e7755-736f-4af6-81d5-09bb0958a5ae",
"type": "main",
"index": 0
}
]
]
},
"ec0bfaa3-9cd0-47d2-8e9b-28f15459c60f": {
"ai_languageModel": [
[
{
"node": "105e7755-736f-4af6-81d5-09bb0958a5ae",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"bfd51a8d-be3e-4649-b03e-91cedd8f40f3": {
"ai_outputParser": [
[
{
"node": "105e7755-736f-4af6-81d5-09bb0958a5ae",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"fb1af74d-c403-427a-af21-cb56127e2369": {
"main": [
[
{
"node": "01efd89a-f09c-4615-82b0-aa563de782dd",
"type": "main",
"index": 0
}
]
]
},
"cf34bdd0-6e61-41f1-9d71-d44b456fb63e": {
"main": [
[
{
"node": "3a050584-6eca-4142-9cec-995157ad1527",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用Google Gemini OCR的自动化财务文档处理
使用Google Gemini OCR的自动化财务文档处理
Set
Code
Merge
+
Set
Code
Merge
76 节点Didac Fernandez
内容创作
✨🩷自动化社交媒体内容发布工厂 + 系统提示组合
基于动态系统提示和GPT-4o的AI驱动多平台社交媒体内容工厂
If
Set
Code
+
If
Set
Code
100 节点Amit Mehta
内容创作
基于 Danelfin、TwelveData 和 Alpha Vantage 的 AI 股票分析
集成 Danelfin、TwelveData 和 Alpha Vantage 的 AI 股票分析系统
Set
Code
Gmail
+
Set
Code
Gmail
74 节点Paul
加密货币交易
使用 PropertyFinder.ae
使用 PropertyFinder.ae、OpenRouter 和 SerpAPI 通过 AI 回答房地产问题
If
Set
Code
+
If
Set
Code
18 节点George Zargaryan
杂项
使用GPT-5和fal.ai图像从关键词到WordPress自动化SEO博客流程
使用GPT-5和fal.ai图像从关键词到WordPress自动化SEO博客流程
Set
Code
Wait
+
Set
Code
Wait
96 节点Paul
内容创作
使用GPT-4o和Claude多代理系统自动化Shopify SEO内容创建
使用GPT-4o和Claude多代理系统自动化Shopify SEO内容创建
Set
Code
Shopify
+
Set
Code
Shopify
92 节点Kumar Shivam
内容创作