Telegram机器人模板
高级
这是一个自动化工作流,包含 35 个节点。主要使用 If, Set, Wait, Telegram, HttpRequest 等节点。 使用Telegram、Fal.AI和Facebook发布自动化产品广告创建
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
- •Facebook Graph API 凭证
使用的节点 (35)
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "qE2VKgGPG7Hxh7fI",
"meta": {
"instanceId": "2c12b0b552404dc07af67cd5f092afd21d18c808d4fdabdb04cb4b064195b6fb",
"templateCredsSetupCompleted": true
},
"name": "Telegram_Bot_Template",
"tags": [
{
"id": "vQcdMpzndwlrDhbx",
"name": "n8n_official_template",
"createdAt": "2025-07-02T13:54:20.087Z",
"updatedAt": "2025-07-02T13:54:20.087Z"
}
],
"nodes": [
{
"id": "bccb5336-76f0-4373-b35f-9d12798ccd1d",
"name": "Send a text message",
"type": "n8n-nodes-base.telegram",
"position": [
832,
112
],
"webhookId": "9d4e8875-5724-4e8f-a2fd-2020f646aae8",
"parameters": {
"text": "Waiting image ads on process...",
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "64c80d0a-8369-4c22-9f61-8e05f049d76f",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
448,
16
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "28LXl50ZdQjnkMJs",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "39ce8fb0-11c6-4c88-9121-4b909379ee34",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
608,
16
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"image_url\": { \"type\": \"string\" },\n \"caption\": { \"type\": \"string\" },\n \"analyzed_description\": { \"type\": \"string\" },\n \"num_variations\": { \"type\": \"integer\", \"minimum\": 1 },\n \"variations\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"variation_id\": { \"type\": \"integer\" },\n \"prompt\": { \"type\": \"string\" },\n \"style\": { \"type\": \"string\" },\n \"scene\": { \"type\": \"string\" },\n \"lighting\": { \"type\": \"string\" },\n \"camera\": { \"type\": \"string\" },\n \"composition\": { \"type\": \"string\" },\n \"background\": { \"type\": \"string\" },\n \"color_mood\": { \"type\": \"string\" },\n \"post_process\": { \"type\": \"string\" },\n \"marketing_angle\": { \"type\": \"string\" }\n },\n \"required\": [\"variation_id\", \"prompt\"]\n }\n }\n },\n \"required\": [\"image_url\", \"caption\", \"analyzed_description\", \"num_variations\", \"variations\"]\n}\n"
},
"typeVersion": 1.3
},
{
"id": "a9569805-f999-40e4-9374-1c2a1aef0d72",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-960,
352
],
"parameters": {
"width": 2144,
"height": 256,
"content": "### 🟨 Zone 3: Generate & Confirm Ad Image (Fal.AI)\n**Purpose:** \nSend the prepared prompt to Fal.AI API to generate an advertising image, \nthen let the user confirm the result.\n**Main Steps:**\n1. **Prepare Fal.AI Input Fields** – Format prompt, image URL, and parameters for Fal.AI API. \n2. **Call Fal.AI API** – Generate the ad image using the given prompt. \n3. **Check Fal.AI Image Status** – Poll until image generation is completed. \n4. **Send Photo Message** – Deliver the generated image to the user on Telegram. \n5. **User Review: Approve/Reject Generated Image** – Ask the user to confirm the result. \n6. **Check Image Approval (Yes/No)** – Proceed only if user confirms."
},
"typeVersion": 1
},
{
"id": "e989e099-1885-4aad-846d-ea353f643750",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
352,
464
],
"webhookId": "469c5fab-ee5c-41ec-8862-615f54d32b95",
"parameters": {
"amount": 10
},
"typeVersion": 1.1
},
{
"id": "ac93bc19-c3a4-4a83-9433-847721bacd22",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-128,
768
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "28LXl50ZdQjnkMJs",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "8eca322c-5e42-41fe-920a-a8c2d02ac902",
"name": "Structured Output Parser1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
32,
768
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"platform\": \"facebook or instagram\",\n \"campaign\": \"string\",\n \"post_text\": \"string\",\n \"hashtags\": [\"#brand\", \"#product\", \"#promotion\", \"#campaign\"]\n}"
},
"typeVersion": 1.3
},
{
"id": "0165ada9-4d77-4a46-8eb6-7b2d675aa8e4",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-960,
112
],
"parameters": {
"color": 3,
"width": 2144,
"height": 224,
"content": "#### 🟥 Zone 2: Create Advertising Image Prompt\n**Purpose:** \nGenerate an AI-ready advertising prompt using the analyzed image description and user input from Telegram.\n\n**Main Steps:**\n1. **User Review: Approve/Reject Ad Prompt** – Ask user for campaign details (e.g. \"10.10 Sale\"). \n2. **Revise Prompt Based on Feedback** – Create a clean, production-ready ad image prompt. \n3. **Send Text Message** – Send the generated prompt back to the user for review or confirmation."
},
"typeVersion": 1
},
{
"id": "a5dd96e0-2158-4e34-bb16-fbdfdd66fb6a",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-960,
-128
],
"parameters": {
"color": 4,
"width": 2144,
"height": 224,
"content": "### 🟩 Zone 1: Product Image Analysis\n**Purpose:** \nReceive a product image from Telegram, extract the file path, and analyze the visual details of the product.\n\n**Main Steps:**\n1. **Receive Product Image (Telegram Trigger)** – Receive product photo or message from the user. \n2. **Get Telegram File Path** – Get the actual image file path via Telegram API. \n3. **Analyze Product Image** – Detect and describe product details such as brand, color, material, and packaging. \n4. **Generate Ad Prompt Draft** – Convert the analysis into structured text for later prompt generation.\n"
},
"typeVersion": 1
},
{
"id": "246a4cc8-4a13-4d04-8a98-de8d92ca2cb9",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-960,
624
],
"parameters": {
"color": 5,
"width": 2144,
"height": 288,
"content": "### 🟦 Zone 4: Create Social Media Caption & Post to Facebook\n**Purpose:** \nAnalyze the final ad image, write a social media caption, and post automatically to Facebook or Instagram.\n**Main Steps:**\n1. **Analyze Final Ad Image (OpenAI Vision)** – Analyze the approved ad image for visual cues. \n2. **Generate Social Media Caption (AI Copywriter)** – Generate engaging Facebook/Instagram post text with emojis and hashtags. \n3. **User Review: Approve/Reject Caption** – Ask the user to approve the caption. \n4. **Check Caption Approval (Yes/No)** – Continue only if user approves. \n5. **Preview Post Image (Telegram)** – Show the preview of the post back to the user. \n6. **Publish Post to Facebook Page** – Upload the image and caption to Facebook Page automatically."
},
"typeVersion": 1
},
{
"id": "32bba9a2-7f30-49fe-8166-88e6ae6ea192",
"name": "Receive Product Image (Telegram Trigger)",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-160,
-96
],
"webhookId": "3bbd63a0-7cbc-4a27-a381-23d83301a19f",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "5c693310-59db-474c-9f99-2a1f20d728f2",
"name": "Get Telegram File Path",
"type": "n8n-nodes-base.httpRequest",
"position": [
32,
-96
],
"parameters": {
"url": "=https://api.telegram.org/bot<YourBotToken>/getFile?file_id={{ $('Receive Product Image (Telegram Trigger)').item.json.message.photo[2].file_id }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "163841fd-657c-4bce-888e-52cc2e009a73",
"name": "Analyze Product Image (OpenAI Vision)",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
256,
-96
],
"parameters": {
"text": "=Depcribe the product and brand in this image in full detail. Fully ignore the background. Focus ONLY on the product.",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"resource": "image",
"simplify": false,
"imageUrls": "=https://api.telegram.org/file/bot<YourBotToken>/{{ $json.result.file_path }}",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"id": "28LXl50ZdQjnkMJs",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "9b8758fe-6705-4ee0-aee3-23461852eff4",
"name": "Generate Ad Prompt Draft (from Image Analysis)",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
464,
-96
],
"parameters": {
"text": "=You will receive:\nhttps://api.telegram.org/file/bot<YourBotToken>/{{ $('Get Telegram File Path').item.json.result.file_path }}\n\n2. Caption: {{ $('Receive Product Image (Telegram Trigger)').item.json.message.caption }}\n3. Analyzed description: {{ $json.choices[0].message.content }}\n4. Number of variations: 1\n\nAnalyze them and generate **1** distinct, advertising-ready image generation prompts.\nUse the image as the factual base and the caption to infer campaign or creative direction.\n\nIf the caption mentions a campaign (e.g., “10.10”, “Christmas”, “Songkran”), apply its mood subtly and naturally.\nIf not, make general high-quality ad visuals.\n\nReturn **only** the JSON according to the schema in the system prompt.",
"options": {
"systemMessage": "=You are an **Advertising Image Prompt Designer**.\n\n### Inputs\nYou will receive:\n- product_image_url: the Telegram image URL of the real product (treat as ground truth)\n- caption: a short instruction describing what to create (e.g., “create ads image for 10.10 campaign”)\n- analyzed_description: AI-generated analysis text describing the product image (e.g., material, color, form, background)\n\n### Goal\nAnalyze both the **product image** and the **caption** to generate exactly **N distinct, production-ready advertising image prompts**.\nEach prompt should be visually distinct and directly usable with image generation models (e.g., SDXL, Midjourney, Flux, Veo).\n\n### Core Requirements\n1. Treat the product image as factual — keep **color, shape, texture, and logo** accurate.\n2. If the caption includes a campaign (e.g., “10.10”, “Songkran”, “Christmas”), apply **seasonal or promotional context** naturally and brand-safely:\n - **Halloween** → warm orange tones, moody light, pumpkins\n - **Songkran** → water splash, outdoor, bright festive vibe\n - **8.8 / 10.10 / 11.11** → energetic sale tone, bold accents, modern backgrounds\n - **Christmas** → cozy, pine, soft warm light, red/green accents\n3. If no campaign is mentioned or caption is generic, generate clean, timeless ad concepts.\n4. For each variation, vary **at least one** of these:\n - Scene / environment \n - Lighting setup \n - Camera angle or lens \n - Composition \n - Background texture or palette \n - Style or art direction \n5. Follow strictly the JSON schema below — **no extra text** or explanation outside the JSON.\n6. If a detail cannot be inferred, set it to an empty string \"\".\n7. All “prompt” values must be **one-line**, no breaks or newlines.\n\n### Quality Rules\n- Use clear and visual language (e.g., “soft daylight on wooden desk”) instead of vague adjectives.\n- Avoid fantasy or surrealism unless explicitly stated.\n- Favor **brand-safe, realistic advertising aesthetics**: packshots, lifestyle, editorial, cinematic.\n- Preserve the identity of the product — do not modify colors, text, or logos.\n- Include camera and lighting suggestions for realism.\n\n### Return Format\nReturn a **single JSON object only** (no commentary), following this schema:"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "c9b449e9-59b1-4f0d-8a26-e5a1831d03ac",
"name": "Assemble Prompt Parameters",
"type": "n8n-nodes-base.set",
"position": [
-160,
128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6cf14a49-26a8-4b61-8e85-effc1d930143",
"name": "caption",
"type": "string",
"value": "={{ $json.output.caption }}"
},
{
"id": "a2731356-2066-4aaa-9522-bc13aa45c6d4",
"name": "prompt",
"type": "string",
"value": "={{ $json.output.variations[0].prompt }}"
},
{
"id": "2d9ea9cd-de6e-41db-8e02-f4a2f4f2d820",
"name": "style",
"type": "string",
"value": "={{ $json.output.variations[0].style }}"
},
{
"id": "815948ae-196b-431e-bcc0-93c971e01596",
"name": "scene",
"type": "string",
"value": "={{ $json.output.variations[0].scene }}"
},
{
"id": "f98c06f9-ba7c-46ab-bb2a-5adc164a7127",
"name": "lighting",
"type": "string",
"value": "={{ $json.output.variations[0].lighting }}"
},
{
"id": "4a8cab78-9679-44f9-b307-9b70f656cc6b",
"name": "camera",
"type": "string",
"value": "={{ $json.output.variations[0].camera }}"
},
{
"id": "db2068bf-a273-40d2-a3e2-4d9348826688",
"name": "composition",
"type": "string",
"value": "={{ $json.output.variations[0].composition }}"
},
{
"id": "10bd62f1-44f6-4372-86e8-b22c2072a84e",
"name": "background",
"type": "string",
"value": "={{ $json.output.variations[0].background }}"
},
{
"id": "c81ebe8b-683e-4004-9382-e340190fc5f4",
"name": "color_mood",
"type": "string",
"value": "={{ $json.output.variations[0].color_mood }}"
},
{
"id": "1dd5535f-e410-45c1-8386-5981f0c55cd5",
"name": "marketing_angle",
"type": "string",
"value": "={{ $json.output.variations[0].marketing_angle }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5500ed80-3304-456c-85b6-e28133d14337",
"name": "User Review: Approve/Reject Ad Prompt",
"type": "n8n-nodes-base.telegram",
"position": [
48,
128
],
"webhookId": "b3340241-04c1-4a74-abf7-d4726c94c802",
"parameters": {
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"message": "=**Caption:** {{ $json.caption }}\n\n**Prompt:** {{ $json.prompt }}\n\n**Style:** {{ $json.style }}\n\n**Scene:** {{ $json.scene }}\n\n**Lighting:** {{ $json.lighting }}\n\n**Camera:** {{ $json.camera }}\n\n**Composition:**{{ $json.composition }}\n\n**Background:** {{ $json.background }}\n\n**Color Mood:** {{ $json.color_mood }}\n\n**Marketing Angle:** {{ $json.marketing_angle }}",
"options": {
"appendAttribution": false
},
"operation": "sendAndWait",
"formFields": {
"values": [
{
"fieldType": "radio",
"fieldLabel": "Approval",
"fieldOptions": {
"values": [
{
"option": "Approve"
},
{
"option": "Reject"
}
]
},
"requiredField": true
},
{
"fieldLabel": "Comment",
"placeholder": "If you Reject, please comment to revise."
}
]
},
"responseType": "customForm"
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "e0ef10fc-fbe7-4e9a-aa6d-495c3dbba207",
"name": "Check Prompt Approval (Yes/No)",
"type": "n8n-nodes-base.if",
"position": [
272,
128
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "26f47c7f-6a13-4bbe-87e3-cb980d86d2ea",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.Approval }}",
"rightValue": "Approve"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "065e5b88-011d-4c22-abbd-6988026aafe9",
"name": "Revise Prompt Based on Feedback",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
464,
144
],
"parameters": {
"text": "=You will receive:\n1.Product Image: https://api.telegram.org/file/bot<YourBotToken>/{{ $('Get Telegram File Path').item.json.result.file_path }}\n\n2. Caption: {{ $('Receive Product Image (Telegram Trigger)').item.json.message.caption }}\n3. Analyzed description: {{ $('Analyze Product Image (OpenAI Vision)').item.json.choices[0].message.content }}\n4. Number of variations: 1\n\n5. Additional Comment: {{ $json.data.Comment }}\n\nAnalyze them and generate **1** distinct, advertising-ready image generation prompts.\nUse the image as the factual base and the caption to infer campaign or creative direction.\n\nIf the caption mentions a campaign (e.g., “10.10”, “Christmas”, “Songkran”), apply its mood subtly and naturally.\nIf not, make general high-quality ad visuals.\n\nReturn **only** the JSON according to the schema in the system prompt.",
"options": {
"systemMessage": "=You are an **Advertising Image Prompt Designer**.\n\n### Inputs\nYou will receive:\n- product_image_url: the Telegram image URL of the real product (treat as ground truth)\n- caption: a short instruction describing what to create (e.g., “create ads image for 10.10 campaign”)\n- analyzed_description: AI-generated analysis text describing the product image (e.g., material, color, form, background)\n\n### Goal\nAnalyze both the **product image** and the **caption** to generate exactly **N distinct, production-ready advertising image prompts**.\nEach prompt should be visually distinct and directly usable with image generation models (e.g., SDXL, Midjourney, Flux, Veo).\n\n### Core Requirements\n1. Treat the product image as factual — keep **color, shape, texture, and logo** accurate.\n2. If the caption includes a campaign (e.g., “10.10”, “Songkran”, “Christmas”), apply **seasonal or promotional context** naturally and brand-safely:\n - **Halloween** → warm orange tones, moody light, pumpkins\n - **Songkran** → water splash, outdoor, bright festive vibe\n - **8.8 / 10.10 / 11.11** → energetic sale tone, bold accents, modern backgrounds\n - **Christmas** → cozy, pine, soft warm light, red/green accents\n3. If no campaign is mentioned or caption is generic, generate clean, timeless ad concepts.\n4. For each variation, vary **at least one** of these:\n - Scene / environment \n - Lighting setup \n - Camera angle or lens \n - Composition \n - Background texture or palette \n - Style or art direction \n5. Follow strictly the JSON schema below — **no extra text** or explanation outside the JSON.\n6. If a detail cannot be inferred, set it to an empty string \"\".\n7. All “prompt” values must be **one-line**, no breaks or newlines.\n\n### Quality Rules\n- Use clear and visual language (e.g., “soft daylight on wooden desk”) instead of vague adjectives.\n- Avoid fantasy or surrealism unless explicitly stated.\n- Favor **brand-safe, realistic advertising aesthetics**: packshots, lifestyle, editorial, cinematic.\n- Preserve the identity of the product — do not modify colors, text, or logos.\n- Include camera and lighting suggestions for realism.\n\n### Return Format\nReturn a **single JSON object only** (no commentary), following this schema:"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "ee5c3f1d-8de9-42cd-8d37-65e11740f108",
"name": "Prepare Fal.AI Input Fields",
"type": "n8n-nodes-base.set",
"position": [
-320,
384
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "62a409c6-c607-452b-9bbb-f3d29c86dddf",
"name": "product_image_URL",
"type": "string",
"value": "=https://api.telegram.org/bot<YourBotToken>/getFile?file_id={{ $('Receive Product Image (Telegram Trigger)').item.json.message.photo[2].file_id }}"
},
{
"id": "a4bbbfad-d9e6-4e0f-a9fa-76b1d04694b0",
"name": "image_prompt",
"type": "string",
"value": "=caption: {{ $('Assemble Prompt Parameters').item.json.caption }}\nprompt: {{ $('Assemble Prompt Parameters').item.json.prompt }}\nstyle: {{ $('Assemble Prompt Parameters').item.json.style }}\nscene: {{ $('Assemble Prompt Parameters').item.json.scene }}\nlighting: {{ $('Assemble Prompt Parameters').item.json.lighting }}\ncamera: {{ $('Assemble Prompt Parameters').item.json.camera }}\ncomposition: {{ $('Assemble Prompt Parameters').item.json.composition }}\nbackground: {{ $('Assemble Prompt Parameters').item.json.background }}\ncolor_mood: {{ $('Assemble Prompt Parameters').item.json.color_mood }}\nmarketing_angle: {{ $('Assemble Prompt Parameters').item.json.marketing_angle }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "71b27b74-f6de-4fbf-a9a1-d4c1683ea424",
"name": "Call Fal.AI API (nano-banana model)",
"type": "n8n-nodes-base.httpRequest",
"position": [
-144,
384
],
"parameters": {
"url": "=https://queue.fal.run/fal-ai/nano-banana/edit",
"method": "=POST",
"options": {},
"jsonBody": "={\n \"prompt\": {{ JSON.stringify(($json.image_prompt || '').replace(/\\r?\\n/g, ' ')) }},\n \"image_urls\": [\n \"https://api.telegram.org/file/bot<YourBotToken>/{{ $('Get Telegram File Path').item.json.result.file_path }}\"\n ],\n \"num_images\": 1,\n \"output_format\": \"jpeg\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "8aXZ3G10Qvvsc8FY",
"name": "Fal AI"
}
},
"typeVersion": 4.2
},
{
"id": "c35e12e6-dd35-4e9d-bda4-a21c241907c5",
"name": "Check Fal.AI Image Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
32,
384
],
"parameters": {
"url": "={{ $json.status_url }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "8aXZ3G10Qvvsc8FY",
"name": "Fal AI"
}
},
"typeVersion": 4.2
},
{
"id": "00965d0b-e5b9-4d29-a5ab-0b71e3827db5",
"name": "Verify Image Generation Completed",
"type": "n8n-nodes-base.if",
"position": [
208,
384
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "38f5427f-4fc7-4c07-87d5-fa7f5964deb2",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "=COMPLETED"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "8042ab3f-e00b-4ea1-81ab-a2309dd3d48f",
"name": "Retrieve Generated Image URL",
"type": "n8n-nodes-base.httpRequest",
"position": [
464,
368
],
"parameters": {
"url": "=https://queue.fal.run/fal-ai/nano-banana/requests/{{ $json.request_id }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "8aXZ3G10Qvvsc8FY",
"name": "Fal AI"
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"alwaysOutputData": false
},
{
"id": "3095aa60-52b3-476d-960f-a5f2e061d478",
"name": "Send Generated Image to Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
640,
368
],
"webhookId": "fde28935-628e-432b-91ed-1f66b5bea421",
"parameters": {
"file": "={{ $json.images[0].url }}",
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"operation": "sendPhoto",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "7c1967b4-0b28-4b64-952d-b2eaeb837cf8",
"name": "User Review: Approve/Reject Generated Image",
"type": "n8n-nodes-base.telegram",
"position": [
832,
368
],
"webhookId": "1c7a83ca-44ea-430f-81c1-779f34505e43",
"parameters": {
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"message": "Do you OK with image that AI generated.? If OK we will generate Caption for social media post.",
"options": {
"appendAttribution": false
},
"operation": "sendAndWait",
"formFields": {
"values": [
{
"fieldType": "radio",
"fieldLabel": "Approval",
"fieldOptions": {
"values": [
{
"option": "Approve"
},
{
"option": "Reject"
}
]
},
"requiredField": true
}
]
},
"responseType": "customForm"
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "626d2622-1b0a-4768-9d83-1a3d3633889a",
"name": "Check Image Approval (Yes/No)",
"type": "n8n-nodes-base.if",
"position": [
1008,
368
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "26f47c7f-6a13-4bbe-87e3-cb980d86d2ea",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.Approval }}",
"rightValue": "Approve"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "44723af0-e3e3-4799-bb67-1cac6167cabc",
"name": "Analyze Final Ad Image (OpenAI Vision)",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-288,
656
],
"parameters": {
"text": "=Depcribe the product and brand in this image in full detail. Fully ignore the background. Focus ONLY on the product.",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"resource": "image",
"simplify": false,
"imageUrls": "={{ $('Retrieve Generated Image URL').item.json.images[0].url }}",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"id": "28LXl50ZdQjnkMJs",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "186baedd-9631-4dfb-9e10-033d2abbbeda",
"name": "Generate Social Media Caption",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-112,
656
],
"parameters": {
"text": "=You will receive:\n\n- caption: {{ $('Receive Product Image (Telegram Trigger)').item.json.message.caption }}\n- analyzed_description: {{ $('Analyze Final Ad Image (OpenAI Vision)').item.json.choices[0].message.content }}\n- platform: \"facebook\"\n\nCreate a social media post for {{ $('Analyze Final Ad Image (OpenAI Vision)').item.json.choices[0].message.content }} suitable for Facebook and Instagram.\nInclude emojis and hashtags that match the campaign tone.\nReturn only JSON as defined in the system prompt.",
"options": {
"systemMessage": "=You are a **Social Media Copywriter AI** specialized in creating engaging Facebook and Instagram posts for product marketing.\n\n### Inputs\nYou will receive:\n- **analyzed_description**: a short text analysis of the product image (from vision AI), describing its appearance, brand, material, packaging, color, or promotional context.\n- **platform**: either “facebook” or “instagram”.\n- **campaign** (optional): may include terms like \"10.10\", \"Christmas\", \"Songkran\", \"none\", etc.\n\n### Goal\nWrite 1 social media post that is engaging, concise, and visually descriptive — optimized for the given platform. \nMake the product the hero of the post, highlight its uniqueness, and create emotional or promotional appeal.\n\n### Writing Style Rules\n- If **campaign** is provided, subtly adapt tone and visuals:\n - **10.10 / 11.11 / 12.12** → energetic, bold, focus on deals and excitement.\n - **Christmas / New Year** → warm, cozy, gift-worthy, festive emojis.\n - **Songkran / Summer** → refreshing, fun, bright energy, water/festival tone.\n - **Halloween** → playful, moody, orange/black vibe.\n - If none → clean, modern, lifestyle-oriented tone.\n- Use **emoji** naturally (2–5 total), matching platform tone.\n- Keep text **short (3–6 lines)** for readability.\n- Avoid hashtags inside sentences; list them at the end.\n- Do **not** fabricate information not found in the analyzed description.\n- Mention product features using emotional and visual cues.\n- Include **call-to-action (CTA)** such as “Shop now”, “Try it today”, or “Limited-time offer”.\n\n### Output Format (JSON only)\nReturn a **single JSON object**:\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "a61e084a-4593-4beb-883e-4fef5289e51b",
"name": "User Review: Approve/Reject Caption",
"type": "n8n-nodes-base.telegram",
"position": [
192,
656
],
"webhookId": "dfe8e316-4f3b-46ba-aa17-baaeb3bfb312",
"parameters": {
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"message": "=This caption for facebook post:\n\n{{ $json.output }}",
"options": {
"appendAttribution": false
},
"operation": "sendAndWait",
"approvalOptions": {
"values": {
"approvalType": "double"
}
}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "f9e12529-a657-4a65-9ab5-f1977ee6cf8e",
"name": "Check Caption Approval (Yes/No)",
"type": "n8n-nodes-base.if",
"position": [
368,
656
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d541205b-6bdb-477c-b8e2-67672228995a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.approved.toString() }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f4f50eb3-a4e9-47b1-8521-3164c09bf99c",
"name": "Preview Post Image (Telegram)",
"type": "n8n-nodes-base.telegram",
"position": [
592,
640
],
"webhookId": "e663fbb9-f3ad-4e8f-a950-23b488aa4c41",
"parameters": {
"file": "={{ $('Retrieve Generated Image URL').item.json.images[0].url }}",
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"operation": "sendPhoto",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "13e34a18-f867-4ef0-9216-8337e28270bd",
"name": "Preview Post Caption (Telegram)",
"type": "n8n-nodes-base.telegram",
"position": [
784,
640
],
"webhookId": "8fe5f776-19a2-4d79-8cc5-ce42132d720a",
"parameters": {
"text": "={{ $('Generate Social Media Caption').item.json.output }}",
"chatId": "={{ $('Receive Product Image (Telegram Trigger)').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "dnHXuiLgkL1Qfilg",
"name": "Telegram_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "7a05e115-49f0-4183-8252-8d2e1ad15cca",
"name": "Publish Post to Facebook Page",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
992,
640
],
"parameters": {
"edge": "photos",
"node": "me",
"options": {
"queryParameters": {
"parameter": [
{
"name": "url",
"value": "={{ $('Retrieve Generated Image URL').item.json.images[0].url }}"
},
{
"name": "message",
"value": "={{ $json.result.text }}"
}
]
}
},
"graphApiVersion": "v23.0",
"httpRequestMethod": "POST"
},
"credentials": {
"facebookGraphApi": {
"id": "7h2Q7242zCuR3sBQ",
"name": "Facebook Post Ads Image"
}
},
"typeVersion": 1
},
{
"id": "86d44dfd-06b8-405a-b651-86e149c646af",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-960,
928
],
"parameters": {
"color": 4,
"width": 336,
"height": 496,
"content": "## Product Image\n"
},
"typeVersion": 1
},
{
"id": "ef71ceb6-8569-48f4-88e1-d1dcf96e9c59",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
-608,
928
],
"parameters": {
"color": 4,
"width": 1792,
"height": 496,
"content": "## Process Step\n   "
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "5c02da28-f114-4aec-bd0a-523916d96ffb",
"connections": {
"e989e099-1885-4aad-846d-ea353f643750": {
"main": [
[
{
"node": "c35e12e6-dd35-4e9d-bda4-a21c241907c5",
"type": "main",
"index": 0
}
]
]
},
"64c80d0a-8369-4c22-9f61-8e05f049d76f": {
"ai_languageModel": [
[
{
"node": "9b8758fe-6705-4ee0-aee3-23461852eff4",
"type": "ai_languageModel",
"index": 0
},
{
"node": "065e5b88-011d-4c22-abbd-6988026aafe9",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"ac93bc19-c3a4-4a83-9433-847721bacd22": {
"ai_languageModel": [
[
{
"node": "186baedd-9631-4dfb-9e10-033d2abbbeda",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"bccb5336-76f0-4373-b35f-9d12798ccd1d": {
"main": [
[
{
"node": "ee5c3f1d-8de9-42cd-8d37-65e11740f108",
"type": "main",
"index": 0
}
]
]
},
"5c693310-59db-474c-9f99-2a1f20d728f2": {
"main": [
[
{
"node": "163841fd-657c-4bce-888e-52cc2e009a73",
"type": "main",
"index": 0
}
]
]
},
"39ce8fb0-11c6-4c88-9121-4b909379ee34": {
"ai_outputParser": [
[
{
"node": "9b8758fe-6705-4ee0-aee3-23461852eff4",
"type": "ai_outputParser",
"index": 0
},
{
"node": "065e5b88-011d-4c22-abbd-6988026aafe9",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"c35e12e6-dd35-4e9d-bda4-a21c241907c5": {
"main": [
[
{
"node": "00965d0b-e5b9-4d29-a5ab-0b71e3827db5",
"type": "main",
"index": 0
}
]
]
},
"8eca322c-5e42-41fe-920a-a8c2d02ac902": {
"ai_outputParser": [
[
{
"node": "186baedd-9631-4dfb-9e10-033d2abbbeda",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"c9b449e9-59b1-4f0d-8a26-e5a1831d03ac": {
"main": [
[
{
"node": "5500ed80-3304-456c-85b6-e28133d14337",
"type": "main",
"index": 0
}
]
]
},
"ee5c3f1d-8de9-42cd-8d37-65e11740f108": {
"main": [
[
{
"node": "71b27b74-f6de-4fbf-a9a1-d4c1683ea424",
"type": "main",
"index": 0
}
]
]
},
"8042ab3f-e00b-4ea1-81ab-a2309dd3d48f": {
"main": [
[
{
"node": "3095aa60-52b3-476d-960f-a5f2e061d478",
"type": "main",
"index": 0
}
]
]
},
"626d2622-1b0a-4768-9d83-1a3d3633889a": {
"main": [
[
{
"node": "44723af0-e3e3-4799-bb67-1cac6167cabc",
"type": "main",
"index": 0
}
],
[
{
"node": "ee5c3f1d-8de9-42cd-8d37-65e11740f108",
"type": "main",
"index": 0
}
]
]
},
"186baedd-9631-4dfb-9e10-033d2abbbeda": {
"main": [
[
{
"node": "a61e084a-4593-4beb-883e-4fef5289e51b",
"type": "main",
"index": 0
}
]
]
},
"f4f50eb3-a4e9-47b1-8521-3164c09bf99c": {
"main": [
[
{
"node": "13e34a18-f867-4ef0-9216-8337e28270bd",
"type": "main",
"index": 0
}
]
]
},
"e0ef10fc-fbe7-4e9a-aa6d-495c3dbba207": {
"main": [
[
{
"node": "bccb5336-76f0-4373-b35f-9d12798ccd1d",
"type": "main",
"index": 0
}
],
[
{
"node": "065e5b88-011d-4c22-abbd-6988026aafe9",
"type": "main",
"index": 0
}
]
]
},
"f9e12529-a657-4a65-9ab5-f1977ee6cf8e": {
"main": [
[
{
"node": "f4f50eb3-a4e9-47b1-8521-3164c09bf99c",
"type": "main",
"index": 0
}
],
[
{
"node": "186baedd-9631-4dfb-9e10-033d2abbbeda",
"type": "main",
"index": 0
}
]
]
},
"13e34a18-f867-4ef0-9216-8337e28270bd": {
"main": [
[
{
"node": "7a05e115-49f0-4183-8252-8d2e1ad15cca",
"type": "main",
"index": 0
}
]
]
},
"065e5b88-011d-4c22-abbd-6988026aafe9": {
"main": [
[
{
"node": "c9b449e9-59b1-4f0d-8a26-e5a1831d03ac",
"type": "main",
"index": 0
}
]
]
},
"3095aa60-52b3-476d-960f-a5f2e061d478": {
"main": [
[
{
"node": "7c1967b4-0b28-4b64-952d-b2eaeb837cf8",
"type": "main",
"index": 0
}
]
]
},
"00965d0b-e5b9-4d29-a5ab-0b71e3827db5": {
"main": [
[
{
"node": "8042ab3f-e00b-4ea1-81ab-a2309dd3d48f",
"type": "main",
"index": 0
}
],
[
{
"node": "e989e099-1885-4aad-846d-ea353f643750",
"type": "main",
"index": 0
}
]
]
},
"71b27b74-f6de-4fbf-a9a1-d4c1683ea424": {
"main": [
[
{
"node": "c35e12e6-dd35-4e9d-bda4-a21c241907c5",
"type": "main",
"index": 0
}
]
]
},
"a61e084a-4593-4beb-883e-4fef5289e51b": {
"main": [
[
{
"node": "f9e12529-a657-4a65-9ab5-f1977ee6cf8e",
"type": "main",
"index": 0
}
]
]
},
"163841fd-657c-4bce-888e-52cc2e009a73": {
"main": [
[
{
"node": "9b8758fe-6705-4ee0-aee3-23461852eff4",
"type": "main",
"index": 0
}
]
]
},
"5500ed80-3304-456c-85b6-e28133d14337": {
"main": [
[
{
"node": "e0ef10fc-fbe7-4e9a-aa6d-495c3dbba207",
"type": "main",
"index": 0
}
]
]
},
"44723af0-e3e3-4799-bb67-1cac6167cabc": {
"main": [
[
{
"node": "186baedd-9631-4dfb-9e10-033d2abbbeda",
"type": "main",
"index": 0
}
]
]
},
"32bba9a2-7f30-49fe-8166-88e6ae6ea192": {
"main": [
[
{
"node": "5c693310-59db-474c-9f99-2a1f20d728f2",
"type": "main",
"index": 0
}
]
]
},
"7c1967b4-0b28-4b64-952d-b2eaeb837cf8": {
"main": [
[
{
"node": "626d2622-1b0a-4768-9d83-1a3d3633889a",
"type": "main",
"index": 0
}
]
]
},
"9b8758fe-6705-4ee0-aee3-23461852eff4": {
"main": [
[
{
"node": "c9b449e9-59b1-4f0d-8a26-e5a1831d03ac",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Multi_Ad_Image
使用Fal.ai和OpenAI从Google表格生成AI产品广告图像
If
Set
Wait
+
If
Set
Wait
22 节点Jaruphat J.
内容创作
Gemini_NanoBanana_模板
使用 Fal.ai 模型(nano-banana、WAN2.2、Veo3)从 Google Sheets 生成 UGC 广告
If
Set
Code
+
If
Set
Code
36 节点Jaruphat J.
内容创作
构建与销售AI自动化与智能体
构建与销售AI自动化与智能体
If
Set
Wait
+
If
Set
Wait
74 节点NICKYAI
其他
AI视频生成器 - OpenAI、ElevenLabs与Telegram YouTube发布
集成OpenAI、ElevenLabs并通过Telegram发布至YouTube的AI视频生成器
If
Set
Wait
+
If
Set
Wait
68 节点FRANK LIN
销售
AI驱动的YouTube Shorts自动化
AI驱动的YouTube Shorts自动化:使用OpenAI和ElevenLabs创建和发布
If
Set
Wait
+
If
Set
Wait
76 节点Jonas Busch
人工智能
AI驱动的YouTube短视频自动化:使用OpenAI和ElevenLabs创建与发布
AI驱动的YouTube Shorts创建器(OpenAI脚本与ElevenLabs语音)
If
Set
Wait
+
If
Set
Wait
76 节点WIKIPILOT
设计
工作流信息
难度等级
高级
节点数量35
分类-
节点类型12
作者
Jaruphat J.
@jaruphatjProject Manager who passionate about Automation & AI and continuously explore innovative ways to improve business processes through intelligent workflow automation. Let’s connect and automate the future!
外部链接
在 n8n.io 查看 →
分享此工作流