Générer des images via Telegram avec Pollinations et un article de blog avec Gemini 2.5
Ceci est unContent Creation, Multimodal AIworkflow d'automatisation du domainecontenant 34 nœuds.Utilise principalement des nœuds comme If, Set, Code, Switch, Telegram. Générer des images et des articles de blog avec Pollinations via Telegram et Gemini 2.5
- •Token Bot Telegram
- •Informations d'identification Google Drive API
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Informations d'identification Google Sheets API
- •Clé API Google Gemini
Nœuds utilisés (34)
Catégorie
{
"meta": {
"instanceId": "ba73835d772fb31a8c93dbcda773c1ef34e21227b9c152c1ee6fdf0eab995f28",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "ad8656b2-a542-4942-a978-23bfe85721db",
"name": "Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
560,
260
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-flash-lite-preview-06-17"
},
"credentials": {
"googlePalmApi": {
"id": "0F73fCXNqVx03YLr",
"name": "Google Gemini(PaLM) Api account 2"
}
},
"typeVersion": 1
},
{
"id": "ae3d4575-e1c9-4fc8-b4ef-d2394e24acb1",
"name": "Déclencher le message Telegram",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1280,
-220
],
"webhookId": "7b019646-348f-4f01-b9ad-c25fb8cdaedc",
"parameters": {
"updates": [
"callback_query",
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1
},
{
"id": "116ee884-b2ea-42af-addd-5e335197c990",
"name": "Classifier l'entrée Telegram",
"type": "n8n-nodes-base.code",
"position": [
-1060,
-220
],
"parameters": {
"jsCode": "let inputType = '';\n\nif ($json.hasOwnProperty(\"callback_query\")) {\n const cbData = $json.callback_query.data || \"\";\n \n if (cbData.startsWith(\"style_\")) {\n inputType = 'style';\n } else {\n inputType = 'callback_query';\n }\n\n} else if (\n $json.hasOwnProperty(\"message\") &&\n $json.message.text === \"/start\"\n) {\n inputType = 'message';\n\n} else if (\n $json.hasOwnProperty(\"message\") &&\n $json.message.text &&\n $json.message.text.toLowerCase().startsWith(\"/help\")\n) {\n inputType = \"help\";\n\n} else if (\n $json.hasOwnProperty(\"message\") &&\n $json.message.text\n) {\n inputType = 'text';\n}\n\nreturn [\n {\n json: {\n ...$json,\n inputType\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "7087e9ef-b1e6-486d-88f1-1a49397579c4",
"name": "Commutateur de type d'entrée",
"type": "n8n-nodes-base.switch",
"position": [
-840,
-240
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "58bd7d4b-4553-4e9c-85ee-a92b50e1e93b",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.inputType }}",
"rightValue": "message"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "e5b29bef-e663-45e1-9e6e-21dde7e2627e",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.inputType }}",
"rightValue": "=callback_query"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "75121808-30dd-4205-adef-e4c4d062ad37",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.inputType }}",
"rightValue": "text"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "6dd8132d-6c99-4b01-b55a-be53cab37bb2",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.inputType }}",
"rightValue": "style"
}
]
}
}
]
},
"options": {},
"looseTypeValidation": true
},
"typeVersion": 3.2
},
{
"id": "d5976879-6a5b-492c-82bd-e4189b4da648",
"name": "Envoyer le menu principal à l'utilisateur",
"type": "n8n-nodes-base.telegram",
"position": [
-620,
-580
],
"webhookId": "effd353c-0bfe-44d9-889e-8314d3034888",
"parameters": {
"text": "Please choose a menu:",
"chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}",
"replyMarkup": "inlineKeyboard",
"inlineKeyboard": {
"rows": [
{
"row": {
"buttons": [
{
"text": "Generate Image",
"additionalFields": {
"callback_data": "image"
}
},
{
"text": "Blog Article",
"additionalFields": {
"callback_data": "blog"
}
},
{
"text": "❓ Help",
"additionalFields": {
"callback_data": "help"
}
}
]
}
}
]
},
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1
},
{
"id": "01112b5e-05f5-4877-bf2d-16ed895b0801",
"name": "Commutateur de sélection de rappel",
"type": "n8n-nodes-base.switch",
"position": [
-640,
-400
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "56c41166-8753-4a92-ae59-68949a001b74",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.callback_query.data }}",
"rightValue": "image"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bd80f13b-f7c6-4578-b23a-5490a04b41b5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.callback_query.data }}",
"rightValue": "blog"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0274338b-4f92-4405-ba57-a80049db0b53",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.callback_query.data }}",
"rightValue": "help"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "672826f4-1a49-41fe-ae3e-36365b5611c6",
"name": "Demander la description d'image à l'utilisateur",
"type": "n8n-nodes-base.telegram",
"position": [
-360,
-760
],
"webhookId": "7f16cbe4-eab9-4690-b07e-4cc207cbc019",
"parameters": {
"text": "Please send an image prompt, start with image",
"chatId": "={{ $json.callback_query.message.chat.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1.2
},
{
"id": "09bc2384-c4c3-4a29-9910-e68622a0621d",
"name": "Demander le titre du blog à l'utilisateur",
"type": "n8n-nodes-base.telegram",
"position": [
-360,
-580
],
"webhookId": "99329519-a287-425d-84ad-5db503f88bd9",
"parameters": {
"text": "Please submit article title, start with blog",
"chatId": "={{ $json.callback_query.message.chat.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1.2
},
{
"id": "9e8d3f41-0d4e-4a06-aab9-289fa374a3a7",
"name": "Valider le format de commande",
"type": "n8n-nodes-base.if",
"position": [
-640,
-220
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "f8a7aca4-5637-44aa-b3ce-dab8fcb25aec",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.message.text.startsWith('image') || $json.message.text.startsWith('blog') }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "892747b0-9fcf-4cca-b781-29d22f782a81",
"name": "Détecter le type d'entrée textuelle",
"type": "n8n-nodes-base.set",
"position": [
-360,
-240
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a82b158b-21dc-4018-8887-1a936e50d525",
"name": "=typeText",
"type": "string",
"value": "={{ $json.inputType === 'text' && $json.message.text && $json.message.text.toLowerCase().startsWith('blog') ? 'blog' : 'image' }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0bf22449-827c-4b9a-991f-cf4d7b18b2c0",
"name": "Commutateur de type de commande texte",
"type": "n8n-nodes-base.switch",
"position": [
-120,
-240
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8375ffa7-4f87-4dd6-ae62-6a908eb61b4f",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.typeText }}",
"rightValue": "image"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bd572c93-d722-4953-a6d3-a3eb1c5f4e5f",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.typeText }}",
"rightValue": "=blog"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "7f184919-2d9e-4ec7-aa3b-f20720c42779",
"name": "Construire l'URL de génération d'image",
"type": "n8n-nodes-base.code",
"position": [
340,
-340
],
"parameters": {
"jsCode": "const width = 1024;\nconst height = 1024;\nconst randomSeed = Math.floor(Math.random() * 100000);\n\nconst finalPrompt = $('Switch Input Type').first().json.message.text;\nconst imageUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(finalPrompt)}.jpg?width=${width}&height=${height}&seed=${randomSeed}&model=flux&nologo=true`;\n\nreturn [\n {\n json: {\n text: finalPrompt,\n imageUrl\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "0699c5a1-a030-4a4f-be9e-8ff615dc4037",
"name": "Télécharger l'image IA",
"type": "n8n-nodes-base.httpRequest",
"position": [
560,
-340
],
"parameters": {
"url": "={{ $json.imageUrl }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "58b67910-d5ed-4993-b71d-a5ca4c31a1f9",
"name": "Envoyer le résultat image à Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
780,
-340
],
"webhookId": "603fa444-2d96-40d2-8e88-37ef980e381c",
"parameters": {
"chatId": "={{ $('Trigger Telegram Message').item.json.message.chat.id }}",
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1.2
},
{
"id": "5ad1b4cd-102d-4786-a11e-329cf9150a81",
"name": "Journaliser l'invite image vers Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
960,
-340
],
"parameters": {
"columns": {
"value": {
"date": "={{ new Date().toLocaleString() }}",
"type": "image",
"output": "={{ $('Download AI Image').item.json.imageUrl }}",
"prompt": "={{ $('Download AI Image').item.json.text }}",
"user id": "={{ $('Validate Command Format').item.json.message.chat.id }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "user id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "output",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "output",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "style",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "style",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit?usp=drivesdk",
"cachedResultName": "History"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8SCk1D65lQur82YT",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "c89ca7b4-3338-4497-90f0-d003562b3487",
"name": "Téléverser l'image vers Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
780,
-520
],
"parameters": {
"name": "={{ $json.text }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1afFdG_eCYtca7fNAz1t7deKxIOcqZ0tv",
"cachedResultUrl": "https://drive.google.com/drive/folders/1afFdG_eCYtca7fNAz1t7deKxIOcqZ0tv",
"cachedResultName": "telegram img generator assets"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "en8M5JCW3g49rIK1",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "ef820546-a244-4b84-bead-914ddc4faeb0",
"name": "Notifier un format d'entrée invalide",
"type": "n8n-nodes-base.telegram",
"position": [
-360,
-80
],
"webhookId": "55090118-c497-41a7-b808-979d49d6a544",
"parameters": {
"text": "❌ Invalid format. Please use image your prompt or blog your title.",
"chatId": "={{ $('Switch Input Type').item.json.message.chat.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1.2
},
{
"id": "de96a570-97cb-491b-bd2d-0c7d0798058c",
"name": "Afficher la saisie pour la réponse d'article",
"type": "n8n-nodes-base.httpRequest",
"position": [
100,
-120
],
"parameters": {
"url": "https://api.telegram.org/bot[your-token]/sendChatAction",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Switch Input Type').item.json.message.chat.id }}"
},
{
"name": "action",
"value": "typing"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "7573c3f9-4c6c-45d5-b7d6-2ace53258d29",
"name": "Afficher la saisie pour la génération d'image",
"type": "n8n-nodes-base.httpRequest",
"position": [
100,
-340
],
"parameters": {
"url": "https://api.telegram.org/bot[your-token]/sendChatAction",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Switch Input Type').item.json.message.chat.id }}"
},
{
"name": "action",
"value": "upload_photo"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "98ee826a-4cb5-415d-b974-23edd06b9a31",
"name": "Envoyer les instructions d'aide",
"type": "n8n-nodes-base.httpRequest",
"position": [
-360,
-400
],
"parameters": {
"url": "https://api.telegram.org/bot{YOUR-TOKEN}/sendMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $json.callback_query.message.chat.id }}"
},
{
"name": "parse_mode",
"value": "Markdown"
},
{
"name": "text",
"value": "=Welcome! Here's how to use this bot:\n\n🖼️ /image\nType the command: \n`image of mountain scenery at sunrise`\n\n📝 /blog \nType the command: \n`blog What is MongoDB`\n\n🧾 Format:\n- Start with the keyword `image` or `blog`\n- After that, write a description or title\n- Without quotation marks\n\n📌 Correct Example:\n- `image of a futuristic house on a cloud`\n- `blog How to Learn React Native for Beginners`\n\nIf you are still confused, type `/start` to open the main menu.\n\nThank you! 🙌\n\nTranslated with DeepL.com (free version)"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "06407eb2-aafd-40aa-bb22-8970d2f08100",
"name": "Envoyer les options de style d'article",
"type": "n8n-nodes-base.telegram",
"position": [
780,
-120
],
"webhookId": "f93e7b41-0c92-4c9a-97c9-d8e34cb16f66",
"parameters": {
"text": "Choose your preferred article style:",
"chatId": "={{ $('Validate Command Format').item.json.message.chat.id }}",
"replyMarkup": "inlineKeyboard",
"inlineKeyboard": {
"rows": [
{
"row": {
"buttons": [
{
"text": "Formal",
"additionalFields": {
"callback_data": "style_formal"
}
},
{
"text": "Relax",
"additionalFields": {
"callback_data": "relax_style"
}
},
{
"text": "News",
"additionalFields": {
"callback_data": "news_style"
}
}
]
}
}
]
},
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "CU5S8GReZfzUW955",
"name": "Tele Image Generator"
}
},
"typeVersion": 1.2
},
{
"id": "7c4d2f57-d083-4a91-991f-6f58d1fef66d",
"name": "Stocker l'invite de blog",
"type": "n8n-nodes-base.set",
"position": [
340,
-120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "30d22676-0174-4723-947e-5d8e604cd320",
"name": "blogTitle",
"type": "string",
"value": "={{ $('Validate Command Format').item.json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c9503a8c-7a61-41db-bc3b-a1ea3c368a87",
"name": "Journaliser l'invite de blog vers Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
560,
-120
],
"parameters": {
"columns": {
"value": {
"id": "={{ $('Validate Command Format').item.json.message.date }}",
"prompt": "={{ $json.blogTitle }}",
"user id": "={{ $('Validate Command Format').item.json.message.chat.id }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "user id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "output",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "output",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "style",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "style",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit?usp=drivesdk",
"cachedResultName": "History"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8SCk1D65lQur82YT",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "452c93e8-4ee9-4b81-a2cc-5e4f65e43864",
"name": "Stocker le style d'article sélectionné",
"type": "n8n-nodes-base.googleSheets",
"position": [
-120,
80
],
"parameters": {
"columns": {
"value": {
"id": "=",
"style": "={{ $json.callback_query.data.replace('style_', '') }}",
"user id": "={{ $json.callback_query.message.chat.id }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "user id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "output",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "output",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "style",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "style",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"user id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "id",
"value": "gid=0"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8SCk1D65lQur82YT",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "da632e75-b26c-44ea-8385-40710ae4259c",
"name": "Récupérer la dernière invite utilisateur",
"type": "n8n-nodes-base.googleSheets",
"position": [
100,
80
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json['user id'] }}",
"lookupColumn": "user id"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit?usp=drivesdk",
"cachedResultName": "History"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8SCk1D65lQur82YT",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "a5de2e3d-cd42-4725-bb41-08f9eed810e1",
"name": "Extraire la dernière invite de blog",
"type": "n8n-nodes-base.code",
"position": [
340,
80
],
"parameters": {
"jsCode": "const userId = $('Switch Input Type').first().json.callback_query.message.chat.id || $('Switch Input Type').first().json.callback_query.message.chat.id\n\nconst rows = items.map(item => item.json);\n\n// Filter data according to User ID\nconst filtered = rows.filter(r => r['user id'] == userId);\n\n// Take the last line of the user\nconst lastRow = filtered[filtered.length - 1];\n\nreturn [{ json: lastRow }];\n"
},
"typeVersion": 2
},
{
"id": "e605824e-3934-4bb1-8303-5ad3a144dd57",
"name": "Générer l'article avec Gemini",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
580,
80
],
"parameters": {
"text": "={{ $json.prompt }}",
"messages": {
"messageValues": [
{
"message": "=Write an English blog post based on the title: {{ $json.Prompt }}.\\n\\nLength about 3 paragraphs. Use the article style {{ $json.Style }}\n\ndo not add any introduction. directly provide the output.\n\nFollow the json format below :\n\n\n {\n \"title\": \"title\",\n \"content\": \"content\"\n }\n"
}
]
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "dc89f75a-1e6d-4cd1-9cdb-d9779663496f",
"name": "Analyser la réponse Gemini",
"type": "n8n-nodes-base.code",
"position": [
960,
80
],
"parameters": {
"jsCode": "const raw = $json.text;\nconst clean = raw.replace(/```json|```/g, '').trim(); // optional: just in case the model still adds\nconst parsed = JSON.parse(clean);\nreturn [{ json: parsed }];"
},
"typeVersion": 2
},
{
"id": "3107ddba-743b-4792-9731-bbd26873abcf",
"name": "Envoyer l'article à Telegram",
"type": "n8n-nodes-base.httpRequest",
"position": [
1180,
80
],
"parameters": {
"url": "https://api.telegram.org/bot-YOURTOKEN/sendMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Extract Last Blog Prompt').item.json['user id'] }}"
},
{
"name": "text",
"value": "={{ $json.title }}\n\n{{ $json.content }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5c5933cd-479e-4255-8ed4-115cfbbc1f01",
"name": "Journaliser l'article final vers Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
1420,
80
],
"parameters": {
"columns": {
"value": {
"id": "=",
"date": "={{ new Date().toLocaleString() }}",
"type": "blog",
"output": "={{ $('Parse Gemini Response').item.json.content }}",
"prompt": "={{ $('Parse Gemini Response').item.json.title }}",
"user id": "={{ $json.result.chat.id }}",
"row_number": "={{ $('Extract Last Blog Prompt').item.json.row_number }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "prompt",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "user id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "output",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "output",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "style",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "style",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCxrF8eJqe_oYY6wZ1Zqo97v96SsXohVVzDgqUHVn1I/edit?usp=drivesdk",
"cachedResultName": "History"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8SCk1D65lQur82YT",
"name": "Google Sheets account 2"
}
},
"typeVersion": 4.5
},
{
"id": "50a9f952-da98-4940-b53a-6c39fb97965b",
"name": "Note autocollante",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3420,
-1660
],
"parameters": {
"width": 640,
"height": 940,
"content": "# Generate Images with Pollinations AI & Blog Articles with Gemini 2.5 from Telegram\n\n\nThis workflow is a multi-functional Telegram bot that allows users to generate:\n\n - 🎨 AI images using Pollinations API\n - 📝 AI-written blog articles using [Gemini AI via LangChain]\n\n\nIt uses Google Sheets to log all user activities and Google Drive to store image assets.\n\n\n## 📲 Example Commands:\nimage a modern smart city at sunset \nblog The Benefits of Remote Work\n\n\n## ✅ Features:\n - Telegram Bot with menu buttons (/start)\n - Detects message type: /start, /help, button callbacks, or free text\n - Validates format (image ... or blog ...)\n - Auto-routes command to:\n - AI Image Generator\n - Blog Article Generator\n - Lets user choose article style: Formal, Casual, News\n - Sends real-time feedback: typing, uploading, error\n - Logs each entry to Google Sheets with timestamp\n - Uploads images to Google Drive folder\n\n\n## 🧾 Requirements:\n - Telegram Bot Token\n - Google Sheets OAuth credential\n - Google Drive OAuth credential\n - Google Gemini API (via LangChain)"
},
"typeVersion": 1
},
{
"id": "c1a9d6fd-2c5b-4450-a2da-4d1e57602703",
"name": "Note autocollante 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2720,
-1660
],
"parameters": {
"color": 3,
"width": 640,
"height": 680,
"content": "## ⚙️ Setup Instructions:\n1. 🔐 Add Credentials to your n8n:\n\n - Telegram API\n - Google Sheets OAuth\n - Google Drive OAuth\n - Google Gemini (PaLM) via LangChain\n\n2. 🧩 Update Variables:\n\n - Replace Google Sheet ID and Drive Folder ID\n - Make sure chat_id expressions are dynamic (avoid hardcoding)\n\n3. 🧪 Test Commands:\n\n - /start → opens main menu\n - image your prompt → generates image\n - blog your title → asks for style → generates article\n\n\n\n## 🔧 Customization Tips:\n1. ✍️ Modify Gemini prompt format in Generate Article with Gemini node\n2. ➕ Add new style types like SEO, Story, Product Review\n3. 🖼 Add more image models (e.g., Stability AI, DALL·E)\n4. 📊 Add category/tags to Sheets for better reporting\n5. 💾 Save responses with filenames using timestamps"
},
"typeVersion": 1
},
{
"id": "0f06dde2-108d-48b4-b2a9-ecd624c48c42",
"name": "Note autocollante 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2020,
-1660
],
"parameters": {
"color": 4,
"width": 560,
"height": 480,
"content": "## 🔐 Security Best Practices:\n1. Do NOT hardcode API keys into HTTP nodes\n2. Store all credentials via n8n credential manager\n3. Avoid exposing actual Sheet/Drive URLs in public templates\n\n\n## 🏁 Summary:\nA powerful Telegram bot for content creators that lets users generate image assets and full-length articles — without ever leaving the chat. Ideal for bloggers, designers, educators, marketers, and developers.\n\n\n## 🔗 Want to Learn More?\n📚 https://n8n.partnerlinks.io/l3i5p47vr7s2\n📚 https://github.com/pollinations/pollinations\n📚 https://aistudio.google.com/apikey"
},
"typeVersion": 1
},
{
"id": "f1271c8b-f7ba-4c62-93cc-02bb5504d767",
"name": "Note autocollante 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3420,
-560
],
"parameters": {
"width": 920,
"height": 1300,
"content": "## 🔁 Google Sheets Integration (📄 Logging System)\nThis workflow uses Google Sheets as a central log for all user activities and generated content.\n\nEach time a user sends a valid prompt (image or blog), a row is appended to the spreadsheet with relevant details.\n\n\n\n## 📊 Sheet Structure\nThe spreadsheet is expected to have one sheet (e.g. Sheet1) with the following columns:\n\n| Column Name | Type | Description |\n| ----------- | -------- | ------------------------------------------------------------ |\n| `Tanggal` | `string` | Date and time of the request (`new Date().toLocaleString()`) |\n| `Prompt` | `string` | The user’s original prompt (image description or blog title) |\n| `User ID` | `string` | Telegram user ID (from message/chat context) |\n| `Jenis` | `string` | Type of generation: `\"image\"` or `\"blog\"` |\n| `Hasil` | `string` | For images: the image URL; for blogs: full content |\n| `Style` | `string` | Writing style (only applicable for blog prompts) |\n\n\n\n## ✅ What’s Logged?\nFor image prompts, it stores the image description, user ID, and image URL.\n\nFor blog prompts, it stores the blog title, selected writing style, and final article content.\n\n\n## ⚙️ Customizing Google Sheets for Other Use Cases\nYou can adapt the column names and fields for your own use. Here are suggestions:\n\n📌 Add a “Category” column if you want to tag prompts (e.g., “Marketing”, “Travel”, “News”)\n\n📌 Track response time by adding a Latency column using Date.now() logic\n\n📌 Include sentiment or keyword analysis with custom AI nodes\n\n📌 Use row_number to update specific entries if needed (already used in blog article flow)\n\n\nTo apply custom columns:\n\n- Open Log Image Prompt to Google Sheets, Log Blog Prompt to Google Sheets, or Log Final Article to Google Sheets node\n\n- Add new fields in the “Columns” > “Value” section\n\n- Map expressions or variables from the current data flow\n\n- Make sure your spreadsheet has matching headers to avoid errors.\n\n\n## 📁 Google Drive Upload (for image)\nIn addition to logging to Sheets, AI-generated images are uploaded to a designated Google Drive folder for archiving.\n\nYou can change the folder ID in the Upload Image to Google Drive node and optionally rename the file to include:\n\nUser ID\nPrompt\nTimestamp"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"0699c5a1-a030-4a4f-be9e-8ff615dc4037": {
"main": [
[
{
"node": "58b67910-d5ed-4993-b71d-a5ca4c31a1f9",
"type": "main",
"index": 0
},
{
"node": "c89ca7b4-3338-4497-90f0-d003562b3487",
"type": "main",
"index": 0
}
]
]
},
"ad8656b2-a542-4942-a978-23bfe85721db": {
"ai_languageModel": [
[
{
"node": "e605824e-3934-4bb1-8303-5ad3a144dd57",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"7c4d2f57-d083-4a91-991f-6f58d1fef66d": {
"main": [
[
{
"node": "c9503a8c-7a61-41db-bc3b-a1ea3c368a87",
"type": "main",
"index": 0
}
]
]
},
"7087e9ef-b1e6-486d-88f1-1a49397579c4": {
"main": [
[
{
"node": "d5976879-6a5b-492c-82bd-e4189b4da648",
"type": "main",
"index": 0
}
],
[
{
"node": "01112b5e-05f5-4877-bf2d-16ed895b0801",
"type": "main",
"index": 0
}
],
[
{
"node": "9e8d3f41-0d4e-4a06-aab9-289fa374a3a7",
"type": "main",
"index": 0
}
],
[
{
"node": "452c93e8-4ee9-4b81-a2cc-5e4f65e43864",
"type": "main",
"index": 0
}
]
]
},
"dc89f75a-1e6d-4cd1-9cdb-d9779663496f": {
"main": [
[
{
"node": "3107ddba-743b-4792-9731-bbd26873abcf",
"type": "main",
"index": 0
}
]
]
},
"da632e75-b26c-44ea-8385-40710ae4259c": {
"main": [
[
{
"node": "a5de2e3d-cd42-4725-bb41-08f9eed810e1",
"type": "main",
"index": 0
}
]
]
},
"116ee884-b2ea-42af-addd-5e335197c990": {
"main": [
[
{
"node": "7087e9ef-b1e6-486d-88f1-1a49397579c4",
"type": "main",
"index": 0
}
]
]
},
"9e8d3f41-0d4e-4a06-aab9-289fa374a3a7": {
"main": [
[
{
"node": "892747b0-9fcf-4cca-b781-29d22f782a81",
"type": "main",
"index": 0
}
],
[
{
"node": "ef820546-a244-4b84-bead-914ddc4faeb0",
"type": "main",
"index": 0
}
]
]
},
"a5de2e3d-cd42-4725-bb41-08f9eed810e1": {
"main": [
[
{
"node": "e605824e-3934-4bb1-8303-5ad3a144dd57",
"type": "main",
"index": 0
}
]
]
},
"3107ddba-743b-4792-9731-bbd26873abcf": {
"main": [
[
{
"node": "5c5933cd-479e-4255-8ed4-115cfbbc1f01",
"type": "main",
"index": 0
}
]
]
},
"0bf22449-827c-4b9a-991f-cf4d7b18b2c0": {
"main": [
[
{
"node": "7573c3f9-4c6c-45d5-b7d6-2ace53258d29",
"type": "main",
"index": 0
}
],
[
{
"node": "de96a570-97cb-491b-bd2d-0c7d0798058c",
"type": "main",
"index": 0
}
]
]
},
"ae3d4575-e1c9-4fc8-b4ef-d2394e24acb1": {
"main": [
[
{
"node": "116ee884-b2ea-42af-addd-5e335197c990",
"type": "main",
"index": 0
}
]
]
},
"01112b5e-05f5-4877-bf2d-16ed895b0801": {
"main": [
[
{
"node": "672826f4-1a49-41fe-ae3e-36365b5611c6",
"type": "main",
"index": 0
}
],
[
{
"node": "09bc2384-c4c3-4a29-9910-e68622a0621d",
"type": "main",
"index": 0
}
],
[
{
"node": "98ee826a-4cb5-415d-b974-23edd06b9a31",
"type": "main",
"index": 0
}
]
]
},
"7f184919-2d9e-4ec7-aa3b-f20720c42779": {
"main": [
[
{
"node": "0699c5a1-a030-4a4f-be9e-8ff615dc4037",
"type": "main",
"index": 0
}
]
]
},
"09bc2384-c4c3-4a29-9910-e68622a0621d": {
"main": [
[]
]
},
"892747b0-9fcf-4cca-b781-29d22f782a81": {
"main": [
[
{
"node": "0bf22449-827c-4b9a-991f-cf4d7b18b2c0",
"type": "main",
"index": 0
}
]
]
},
"e605824e-3934-4bb1-8303-5ad3a144dd57": {
"main": [
[
{
"node": "dc89f75a-1e6d-4cd1-9cdb-d9779663496f",
"type": "main",
"index": 0
}
]
]
},
"452c93e8-4ee9-4b81-a2cc-5e4f65e43864": {
"main": [
[
{
"node": "da632e75-b26c-44ea-8385-40710ae4259c",
"type": "main",
"index": 0
}
]
]
},
"58b67910-d5ed-4993-b71d-a5ca4c31a1f9": {
"main": [
[
{
"node": "5ad1b4cd-102d-4786-a11e-329cf9150a81",
"type": "main",
"index": 0
}
]
]
},
"c9503a8c-7a61-41db-bc3b-a1ea3c368a87": {
"main": [
[
{
"node": "06407eb2-aafd-40aa-bb22-8970d2f08100",
"type": "main",
"index": 0
}
]
]
},
"de96a570-97cb-491b-bd2d-0c7d0798058c": {
"main": [
[
{
"node": "7c4d2f57-d083-4a91-991f-6f58d1fef66d",
"type": "main",
"index": 0
}
]
]
},
"7573c3f9-4c6c-45d5-b7d6-2ace53258d29": {
"main": [
[
{
"node": "7f184919-2d9e-4ec7-aa3b-f20720c42779",
"type": "main",
"index": 0
}
]
]
},
"5ad1b4cd-102d-4786-a11e-329cf9150a81": {
"main": [
[]
]
},
"5c5933cd-479e-4255-8ed4-115cfbbc1f01": {
"main": [
[]
]
}
}
}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é - Création de contenu, IA Multimodale
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
Fahmi Oktafian
@fahmi3322Hi! I’m Fahmi Oktafian, a developer and automation enthusiast with expertise in n8n, Node.js, and API integrations. I specialize in building smart, scalable workflows — from auto-publishing content to WordPress, sending automated Telegram notifications, to processing AI-based summaries and paraphrase. I’m passionate about helping businesses save time, increase efficiency, and automate their digital processes with clean and user-friendly solutions.
Partager ce workflow