使用 NanoBanana 🍌和 Telegram 的表单提交 UGC 图片生成器
中级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 Set, Code, Merge, Telegram, FormTrigger 等节点。 使用 Google Gemini 和 Telegram 从表单提交生成 UGC 图片
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "UM5yN01ZX3V2f256",
"meta": {
"instanceId": "237139412ba2bdccb5393d058ace6ee50c6bb809e4f130ea2f9b24f70a336b94",
"templateCredsSetupCompleted": true
},
"name": "使用NanoBanana 🍌和Telegram的表单提交UGC图片生成器",
"tags": [],
"nodes": [
{
"id": "15aee33e-9193-4bb2-9f9a-cc4ed5cd8eb5",
"name": "Google gemini",
"type": "n8n-nodes-base.httpRequest",
"position": [
1168,
0
],
"parameters": {
"url": "https://openrouter.ai/api/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"google/gemini-2.5-flash-image-preview\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Create a realistic and engaging UGC image highlighting this Character product. : {{ $json.personnage }}. Style: lifestyle photo, taken on a smartphone, natural, authentic, and spontaneous atmosphere. Context: the subject holds/uses the product in a simple and natural way: natural light, simple background (living room, office, or urban outdoor setting), soft colors, mid-body framing. Objective: to give the impression that it is a real person recommending the product in UGC content.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"{{ $json.image }}\"\n }\n }\n ]\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "openRouterApi"
},
"credentials": {
"openRouterApi": {
"id": "JGTQZSwkY8TvDVDW",
"name": "OpenRouter account 2"
}
},
"typeVersion": 4.2
},
{
"id": "4d644794-edfa-411e-950e-2a35aee608bf",
"name": "数据映射",
"type": "n8n-nodes-base.set",
"position": [
976,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5ba24889-ccd2-4b28-be4e-ba85eb4a1827",
"name": "image",
"type": "string",
"value": "={{ $json.image_url }}"
},
{
"id": "cd52d79a-16b7-41ad-8673-e8a01fc0bd28",
"name": "personnage",
"type": "string",
"value": "={{ $json.modele_personnage }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "813f07a4-a764-4284-9388-cc3a46b50c13",
"name": "发送照片消息",
"type": "n8n-nodes-base.telegram",
"position": [
1808,
0
],
"webhookId": "441e3c91-85fd-4b25-bf68-0f28b0d6d697",
"parameters": {
"chatId": "@assistantjaures",
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "LPcm8lL2x487aGuB",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "1a80e40a-b565-4a94-8d50-18ed5a12f2ff",
"name": "包含角色类型和图片的表单提交",
"type": "n8n-nodes-base.formTrigger",
"position": [
-144,
-16
],
"webhookId": "251cf601-cb55-403d-86f7-f64f8f52e45a",
"parameters": {
"options": {
"appendAttribution": false
},
"formTitle": "Advertising image generator",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "Product image",
"multipleFiles": false,
"requiredField": true,
"acceptFileTypes": ".jpg, .png, .jpeg"
},
{
"fieldType": "dropdown",
"fieldLabel": "Character model",
"fieldOptions": {
"values": [
{
"option": "Homme"
},
{
"option": "Femme"
}
]
},
"requiredField": true
}
]
},
"formDescription": "Turn simple product images into high-quality advertising images"
},
"typeVersion": 2.2
},
{
"id": "76f275ec-0500-4df8-a533-1afd5e5ccf7a",
"name": "提取表单文件",
"type": "n8n-nodes-base.extractFromFile",
"position": [
256,
64
],
"parameters": {
"options": {},
"operation": "binaryToPropery",
"destinationKey": "image_base64",
"binaryPropertyName": "Image_du_produit"
},
"typeVersion": 1
},
{
"id": "68788867-9960-4c5e-a08c-802ce0604215",
"name": "合并两个数据集",
"type": "n8n-nodes-base.merge",
"position": [
528,
0
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "b95becf0-1bdd-4e55-9040-a428cd6eb3e3",
"name": "创建数据URL",
"type": "n8n-nodes-base.code",
"position": [
752,
0
],
"parameters": {
"jsCode": "// We take the first item.\nconst item = $input.item.json;\n\n// Character model retrieval\nconst modele = item[\"Modèle de personnage\"];\n\n// Base64 recovery\nconst imageBase64 = item[\"image_base64\"];\n\n// Creating a Data URL that can be used in an API\n// ⚡ Change “image/jpeg” if your image is PNG.\nconst imageUrl = `data:image/jpeg;base64,${imageBase64}`;\n\n// Turn everything over\nreturn [\n {\n json: {\n modele_personnage: modele,\n image_url: imageUrl\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "80f40071-4c24-4dd5-bc6a-9cab0fcfa7e6",
"name": "转换URL数据",
"type": "n8n-nodes-base.code",
"position": [
1376,
0
],
"parameters": {
"jsCode": "const output = items[0].json;\n\n// Extraire le base64 depuis choices[0].message.images[0].image_url.url\nlet base64Data = output.choices[0].message.images[0].image_url.url;\n\n// Enlever le préfixe \"data:image/png;base64,\"\nbase64Data = base64Data.replace(/^data:image\\/\\w+;base64,/, \"\");\n\n// Retourner dans un champ \"data\" → Convert to File va l'utiliser\nreturn [\n {\n json: {\n data: base64Data\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "ef8c6191-80bf-40fb-ad4d-f7d9ad0d3978",
"name": "下载文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
1584,
0
],
"parameters": {
"options": {},
"operation": "toBinary",
"sourceProperty": "data"
},
"typeVersion": 1.1
},
{
"id": "23860a70-7beb-494d-a49b-bb7f83febb7d",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-128
],
"parameters": {
"color": 6,
"width": 288,
"height": 368,
"content": "## 包含角色类型和图片的表单提交"
},
"typeVersion": 1
},
{
"id": "e9f831db-eeb7-4780-8a96-6b237b6637f8",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
144,
-128
],
"parameters": {
"color": 6,
"width": 560,
"height": 368,
"content": "## 提取表单文件并合并两个数据集"
},
"typeVersion": 1
},
{
"id": "b8431775-7a92-4174-a6aa-9da3ccb55ff3",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
-128
],
"parameters": {
"color": 6,
"width": 592,
"height": 368,
"content": "## NanoBanana UGC图片生成器"
},
"typeVersion": 1
},
{
"id": "48eb75e1-ed81-471a-a774-d4caf3d52bbd",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1552,
-128
],
"parameters": {
"color": 6,
"width": 496,
"height": 368,
"content": "## UGC图片生成并发送到Telegram"
},
"typeVersion": 1
},
{
"id": "1cb6780e-468d-4b9e-87d2-dd5d0152db53",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-288,
-352
],
"parameters": {
"color": 7,
"width": 2400,
"height": 752,
"content": "## 此工作流通过允许用户提交包含以下内容的表单来自动创建UGC(用户生成内容)图片:"
},
"typeVersion": 1
},
{
"id": "fd1e5d7b-bbcb-4478-aa8e-18d85503c8e9",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-352
],
"parameters": {
"width": 720,
"height": 1344,
"content": "## 此工作流基于表单提交自动生成个性化UGC(用户生成内容)图片。"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "45583225-c701-4d95-8ca6-6f650fdd08ad",
"connections": {
"Mapping": {
"main": [
[
{
"node": "Google gemini",
"type": "main",
"index": 0
}
]
]
},
"Google gemini": {
"main": [
[
{
"node": "Transform URL data",
"type": "main",
"index": 0
}
]
]
},
"Download the file": {
"main": [
[
{
"node": "Send a photo message",
"type": "main",
"index": 0
}
]
]
},
"Transform URL data": {
"main": [
[
{
"node": "Download the file",
"type": "main",
"index": 0
}
]
]
},
"Creating a data URL": {
"main": [
[
{
"node": "Mapping",
"type": "main",
"index": 0
}
]
]
},
"Extract the form file": {
"main": [
[
{
"node": "Merge the two data sets",
"type": "main",
"index": 1
}
]
]
},
"Merge the two data sets": {
"main": [
[
{
"node": "Creating a data URL",
"type": "main",
"index": 0
}
]
]
},
"Form submission with character type and image": {
"main": [
[
{
"node": "Merge the two data sets",
"type": "main",
"index": 0
},
{
"node": "Extract the form file",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Google Slides 和 Flux 将会议转录转换为 AI 生成演示文稿
使用 Google Slides 和 Flux 将会议转录转换为 AI 生成演示文稿
Set
Code
Wait
+14
107 节点Joseph
内容创作
家居装饰AI(Google Nano Banana)- Santhej Kallada
基于Google Gemini的AI图像生成与编辑及Telegram机器人
If
Set
Code
+9
28 节点Santhej Kallada
内容创作
✨🩷自动化社交媒体内容发布工厂 + 系统提示组合
基于动态系统提示和GPT-4o的AI驱动多平台社交媒体内容工厂
If
Set
Code
+20
100 节点Amit Mehta
内容创作
从趋势电子表格生成SEO内容到存储(SharePoint/Drive/Dropbox)
使用GPT-4o、FAL AI和多存储支持从趋势自动生成SEO内容
If
Set
Code
+13
47 节点plemeo
内容创作
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
Set
Code
Wait
+16
97 节点Adam Crafts
内容创作