Modèle de bot Telegram
Ceci est uncontenant 35 nœuds.Utilise principalement des nœuds comme If, Set, Wait, Telegram, HttpRequest. Automatiser la création de publicités produits via Telegram, Fal.AI et la publication sur Facebook
- •Token Bot Telegram
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Clé API OpenAI
- •Informations d'identification Facebook Graph API
Nœuds utilisés (35)
Catégorie
{
"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": "Envoyer un message texte",
"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": "Analyseur de Sortie Structurée",
"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": "Note adhésive",
"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": "Attente",
"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": "Analyseur de Sortie Structurée1",
"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": "Note adhésive1",
"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": "Note adhésive2",
"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": "Note adhésive3",
"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": "Recevoir l'Image du Produit (Déclencheur Telegram)",
"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": "Obtenir le Chemin du Fichier Telegram",
"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": "Analyser l'Image du Produit (Vision OpenAI)",
"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": "Générer un Brouillon de Prompt Publicitaire (à partir de l'Analyse d'Image)",
"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": "Assembler les Paramètres du Prompt",
"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": "Revue Utilisateur : Approuver/Rejeter le Prompt Publicitaire",
"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": "Vérifier l'Approbation du Prompt (Oui/Non)",
"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": "Réviser le Prompt sur Base des Retours",
"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": "Préparer les Champs d'Entrée Fal.AI",
"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": "Appeler Fal.AI API (modèle nano-banana)",
"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": "Vérifier le Statut de l'Image Fal.AI",
"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": "Vérifier que la Génération d'Image est Terminée",
"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": "Récupérer l'URL de l'Image Générée",
"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": "Envoyer l'Image Générée à 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": "Revue Utilisateur : Approuver/Rejeter l'Image Générée",
"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": "Vérifier l'Approbation de l'Image (Oui/Non)",
"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": "Analyser l'Image Publicitaire Finale (Vision OpenAI)",
"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": "Générer une Légende pour les Réseaux Sociaux",
"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": "Revue Utilisateur : Approuver/Rejeter la Légende",
"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": "Vérifier l'Approbation de la Légende (Oui/Non)",
"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": "Aperçu de l'Image de la Publication (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": "Aperçu de la Légende de la Publication (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": "Publier sur la Page Facebook",
"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": "Note adhésive4",
"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": "Note adhésive5",
"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
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
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!
Partager ce workflow