This workflow follows the Googlegemini → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Kilua-Bot",
"nodes": [
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.2,
"position": [
-848,
560
],
"id": "aa73aca3-3622-479c-a24b-83b2bc6cfe48",
"name": "Telegram Trigger",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Pegar o JSON da primeira entrada (padr\u00e3o do Telegram Trigger)\nconst input = items[0] && items[0].json ? items[0].json : { message: { text: \"\", chat: { id: null } } };\n\nconst mensagem = (input.message && input.message.text) ? input.message.text.trim() : \"\";\nconst chat_id = (input.message && input.message.chat && input.message.chat.id) ? input.message.chat.id : null;\n\nconst comandosBasicos = [\"/menu\", \"/help\", \"/genclass\", \"/genflow\", \"/gencase\", \"/start\"];\n\n// --- L\u00d3GICA DE PARSING ---\nconst isComando = mensagem.startsWith(\"/\");\nconst partes = mensagem.split(' ');\nconst comandoRecebido = partes[0].toLowerCase(); // Convertendo para min\u00fasculo para evitar erros\n\n// --- NOVA L\u00d3GICA DE DETEC\u00c7\u00c3O DE FERRAMENTA ---\nlet ferramenta = 'plantuml'; // <--- AQUI MUDOU: O padr\u00e3o agora \u00e9 PlantUML\nlet inicioDescricao = 1; // Come\u00e7a a ler a descri\u00e7\u00e3o ap\u00f3s o comando (palavra \u00edndice 1)\n\n// Se a mensagem tiver mais de uma palavra E a segunda palavra for uma ferramenta conhecida\n// (Isso permite que o usu\u00e1rio force 'mermaid' se quiser, digitando: /genclass mermaid ...)\nif (partes.length > 1 && (partes[1].toLowerCase() === 'plantuml' || partes[1].toLowerCase() === 'mermaid')) {\n ferramenta = partes[1].toLowerCase();\n inicioDescricao = 2; // A descri\u00e7\u00e3o agora come\u00e7a depois da ferramenta (palavra \u00edndice 2)\n}\n\n// Reconstr\u00f3i a descri\u00e7\u00e3o a partir do ponto correto\nconst descricao = partes.slice(inicioDescricao).join(' ');\n\n// Verifica se o comando recebido est\u00e1 na nossa lista\nconst isValido = comandosBasicos.includes(comandoRecebido);\n// -------------------------\n\n// Retorna o objeto JSON limpo para os pr\u00f3ximos n\u00f3s\nreturn [\n {\n json: {\n chat_id: chat_id,\n mensagemCompleta: mensagem,\n isComando: isComando,\n isValido: isValido,\n comando: comandoRecebido,\n ferramenta: ferramenta,\n descricao: descricao\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-640,
560
],
"id": "f1a9af83-5984-486c-b363-fad285fbf6f2",
"name": "Code in JavaScript"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c19fa04d-eb3e-4098-acff-88d05a6b7b45",
"leftValue": "={{ $json.isValido }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-432,
560
],
"id": "2d3206e0-531a-46a4-a4c3-b89eef4edfc6",
"name": "If"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/menu",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "b8f06c2e-c56c-45d2-9f7a-f38d772aee75"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "fa3a8430-b7d4-4bdc-aaf3-5e6f8a9e140e",
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/genclass",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c38f80ed-669e-4654-ab45-d98114108147",
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/genflow",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "a2715d5e-b762-4de5-9ffc-c70b5b6483ec",
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/gencase",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "0e5bd4b4-ad67-45b1-bd94-58e517c7c79a",
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/help",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "6bcbd1b6-7eb0-47b3-9ba9-7e11932f20aa",
"leftValue": "={{ $('Code in JavaScript').item.json.comando }}",
"rightValue": "/start",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.3,
"position": [
-256,
224
],
"id": "75282308-5a26-4bbf-90bd-b9614151c8fd",
"name": "Switch"
},
{
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "=\ud83d\udc4b *Salve! Eu sou o Killua.*\n\nSou teu parceiro de automa\u00e7\u00e3o UML. Eu transformo textos e c\u00f3digos em diagramas visuais num estalar de dedos (ou melhor, em um digitar de dedos).\n\n\ud83d\ude80 *Mudan\u00e7a Importante:*\nAgora utilizo o **PlantUML** como motor padr\u00e3o. Ele \u00e9 mais potente e garante que seus diagramas n\u00e3o quebrem, mesmo nos cen\u00e1rios mais complexos.\n_(O Mermaid ainda est\u00e1 dispon\u00edvel como op\u00e7\u00e3o, mas use com modera\u00e7\u00e3o!)_\n\n\ud83d\udccb *Comandos R\u00e1pidos:*\n\u2744\ufe0f `/genClass` - Estrutura e Classes\n\u2744\ufe0f `/genFlow` - Fluxogramas e L\u00f3gica\n\u2744\ufe0f `/genCase` - Atores e Requisitos\n\u2744\ufe0f `/menu` - Menu interativo\n\n--------------------------------------------------\n\ud83d\udcda *Documenta\u00e7\u00e3o Completa:*\nQuer aprender a usar comandos avan\u00e7ados, colar c\u00f3digo direto \ne entender as diferen\u00e7as entre os motores?\n\n\ud83d\udc49 [Clique aqui para ler o Manual Oficial do Kilua](https://github.com/JpSeveroo/n8n-Applications/blob/main/n8n_workflows/Kilua/README.md)\n\n_Bora criar uns diagramas insanos?_ \ud83d\ude0f\u2744\ufe0f\n--------------------------------------------------",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
32,
464
],
"id": "cdcd4e4e-ed37-4fb2-90fa-7fa7d512fb17",
"name": "/help",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "=*\ud83d\udc4b Salveee, Killua na voz* . Qual a bronca de hoje? \n\n*Esses s\u00e3o meus comandos:* \n\n\u2744\ufe0f /menu\n\u2744\ufe0f /genClass \n\u2744\ufe0f /genFlow\n\u2744\ufe0f /genCase\n\u2744\ufe0f /help \n\n*\u26a0\ufe0f Se \u00e9 a primeira vez usando recomendo dar um \"/help\" para ficar por dentro.* \n---------------------------------------------------",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
0,
0
],
"id": "15eac0aa-c060-4084-911c-6eec319db3a3",
"name": "/menu",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "=\ud83e\udd16 Opa! N\u00e3o reconheci esse comando. Digite /menu para ver todos os comandos dispon\u00edveis.",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
-128,
896
],
"id": "6450cffc-6db0-4fae-aaf9-ad410ebf61a4",
"name": "escape",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d58cd0b2-5e2b-4223-b705-d06b4bae4929",
"name": "=prompt_ia",
"value": "=Voc\u00ea \u00e9 um gerador autom\u00e1tico de diagramas UML. \nSua tarefa \u00e9 produzir APENAS o c\u00f3digo do diagrama, sem qualquer explica\u00e7\u00e3o, coment\u00e1rio ou texto adicional.\n\nREGRAS ABSOLUTAS (N\u00c3O QUEBRE):\n1. Voc\u00ea est\u00e1 totalmente PROIBIDO de escrever qualquer frase fora do c\u00f3digo UML.\n2. Sua resposta deve come\u00e7ar EXCLUSIVAMENTE pela palavra-chave do diagrama:\n - Para Mermaid: graph, flowchart, classDiagram, sequenceDiagram, stateDiagram, erDiagram, gantt, pie, usecaseDiagram\n - Para PlantUML: @startuml\n3. Voc\u00ea est\u00e1 PROIBIDO de escrever qualquer coisa antes ou depois do c\u00f3digo.\n4. N\u00c3O escreva markdown (sem ```).\n5. N\u00c3O escreva texto normal.\n6. N\u00c3O explique nada.\n7. N\u00c3O adicione coment\u00e1rios.\n8. N\u00c3O coloque linhas extras fora do diagrama.\n\nENTRADA:\nTipo do comando: {{ $json.comando }}\nFerramenta: {{ $json.ferramenta }}\nDescri\u00e7\u00e3o detalhada: {{ $json.descricao }}\n\nSA\u00cdDA:\n- Responda SOMENTE com o diagrama UML correspondente.\n- N\u00c3O coloque texto antes.\n- N\u00c3O coloque texto depois.\n- Gere SOMENTE o c\u00f3digo puro.\n\nCASO MERMAID:\n- A sa\u00edda deve come\u00e7ar imediatamente com a palavra-chave do diagrama escolhida (ex: \"graph TD\" ou \"usecaseDiagram\").\n\nCASO PLANTUML:\n- A sa\u00edda deve come\u00e7ar com \"@startuml\" e terminar com \"@enduml\".\n\nAGORA GERE APENAS O C\u00d3DIGO PURO:\n",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
0,
272
],
"id": "9355c2ad-362c-4483-99d5-59aea5889786",
"name": "Comandos"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"messages": {
"values": [
{
"content": "={{ $json.prompt_ia }}"
}
]
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1,
"position": [
320,
528
],
"id": "6797e75b-d65d-4027-9b59-ae11bda51508",
"name": "Message a model",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $('Code in JavaScript').item.json.ferramenta }}",
"rightValue": "mermaid",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "e6599fcd-5156-4db9-830a-1aecb0d4be1c"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "4d70fb0c-0d44-42e0-b37f-35d9355a46d8",
"leftValue": "={{ $('Code in JavaScript').item.json.ferramenta }}",
"rightValue": "plantuml",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.3,
"position": [
832,
528
],
"id": "330f90ec-0401-4540-83be-96b278f9f36e",
"name": "Switch1"
},
{
"parameters": {
"url": "={{ $json.url_imagem }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1424,
272
],
"id": "c189713d-a455-413a-8de8-54da249432f1",
"name": "HTTP Request"
},
{
"parameters": {
"jsCode": "// Pega o texto do diagrama que veio do Gemini\n// Ajuste 'Switch1' se o nome do seu n\u00f3 anterior for diferente\nconst diagrama = items[0].json.texto_limpo;\n\n// Converte para Base64 (exigido pelo mermaid.ink)\nconst encoded = Buffer.from(diagrama).toString('base64');\n\n// Retorna a URL pronta para o pr\u00f3ximo n\u00f3 usar\nreturn [{\n json: {\n url_imagem: `https://mermaid.ink/img/${encoded}`\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1152,
272
],
"id": "a32ff24d-be3b-49da-9123-b78a028222ae",
"name": "Transforming in url mermaid"
},
{
"parameters": {
"jsCode": "// Pega o texto do diagrama que veio do Gemini\nconst diagrama = items[0].json.texto_limpo;\n\n// TRUQUE DE MESTRE: Converte para HEX (Hexadecimal)\n// O PlantUML aceita isso se colocarmos '~h' na frente depois.\nconst encoded = Buffer.from(diagrama).toString('hex');\n\nreturn [{\n json: {\n // Monta a URL final usando o servidor oficial e o prefixo ~h\n url_imagem: `http://www.plantuml.com/plantuml/png/~h${encoded}`\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1152,
864
],
"id": "f3db0684-98ca-4c53-bd21-9283bb4f7df7",
"name": "transforming url plantuml"
},
{
"parameters": {
"url": "={{ $json.url_imagem }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1472,
864
],
"id": "82d1d27e-d402-4902-8e1f-268bce9053aa",
"name": "HTTP Request1"
},
{
"parameters": {
"operation": "sendPhoto",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"binaryData": true,
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1744,
608
],
"id": "4fe36d0c-5cb2-42fa-8806-06cb1c649b8d",
"name": "Send a photo message",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "let texto = items[0].json.content.parts[0].text;\n\n// Remove markdown\ntexto = texto.replace(/```/g, \"\");\n\n// Remove texto ANTES da primeira linha v\u00e1lida do Mermaid:\ntexto = texto.replace(/^.*?(graph|flowchart|classDiagram|sequenceDiagram|erDiagram|gantt|pie|usecaseDiagram)/s, \n (match) => match.match(/(graph|flowchart|classDiagram|sequenceDiagram|erDiagram|gantt|pie|usecaseDiagram)/)[0]\n);\n\n// Remove lixo depois do diagrama (caso o modelo fale algo no final)\ntexto = texto.replace(/(@enduml|}$)\\s*[\\s\\S]*$/, \"$1\");\n\nreturn [{ json: { texto_limpo: texto }}];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
656,
528
],
"id": "612f9fc6-8b5a-4036-a527-65d809aaafee",
"name": "Code in JavaScript1"
},
{
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "=\u26a1 *Dalee! Eu sou o Kilua.*\n_Seu Arquiteto de Software de bolso._\n\nChega de perder tempo arrastando caixinhas. Me descreva seu sistema ou cole seu c\u00f3digo, e eu desenho a arquitetura pra voc\u00ea em segundos usando Intelig\u00eancia Artificial.\n\n\ud83d\ude80 *O que eu construo pra voc\u00ea:*\n\ud83c\udfdb\ufe0f **Classes** (Estrutura de c\u00f3digo)\n\ud83d\udd00 **Fluxogramas** (L\u00f3gica e Processos)\n\ud83d\udc64 **Casos de Uso** (Requisitos e Atores)\n\n\ud83d\udc47 *Por onde come\u00e7amos?*\nDigite **/menu** para ver as ferramentas \nou **/help** para entender como eu funciono.\n\n_Vamos automatizar essa documenta\u00e7\u00e3o?_ \ud83d\udc4a\n--------------------------------------------------",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
192,
896
],
"id": "e06660e1-56ad-422d-9138-a161c4d06917",
"name": "/menu1",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
],
[
{
"node": "escape",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "/menu",
"type": "main",
"index": 0
}
],
[
{
"node": "Comandos",
"type": "main",
"index": 0
}
],
[
{
"node": "Comandos",
"type": "main",
"index": 0
}
],
[
{
"node": "Comandos",
"type": "main",
"index": 0
}
],
[
{
"node": "/help",
"type": "main",
"index": 0
}
],
[
{
"node": "/menu1",
"type": "main",
"index": 0
}
]
]
},
"Comandos": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Switch1": {
"main": [
[
{
"node": "Transforming in url mermaid",
"type": "main",
"index": 0
}
],
[
{
"node": "transforming url plantuml",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Send a photo message",
"type": "main",
"index": 0
}
]
]
},
"Transforming in url mermaid": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"transforming url plantuml": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[
{
"node": "Send a photo message",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Switch1",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"versionId": "09a8310e-1a3a-41fc-ac06-394d8ced6b4c",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "Fd5SPbhamu5OiMO0",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Kilua-Bot. Uses telegramTrigger, telegram, googleGemini, httpRequest. Event-driven trigger; 17 nodes.
Source: https://github.com/JpSeveroo/n8n-Applications/blob/f22ed5446c713ac3da904cd1b650143c0a8ee91e/n8n_workflows/Kilua/killuaBot.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Sales Lead Qualifier. Uses telegramTrigger, googleSheets, telegram, googleGemini. Event-driven trigger; 41 nodes.
This workflow is a complete, AI-powered content engine designed to help automation experts build their personal brand on LinkedIn. It transforms a technical n8n workflow (in JSON format) into a polish
This workflow allows Telegram users to submit a domain for quick threat intelligence analysis. It queries VirusTotal, AbuseCH URLHaus, and AbuseCH ThreatFox, then uses Gemini AI to generate a formatte
This workflow is perfect for: E-commerce sellers needing quick product videos Social media marketers creating content at scale Small business owners without video editing skills Product photographers
E-commerce businesses needing quick product ads Social media marketers without design resources Small business owners creating promotional content Product photographers seeking automated enhancements