Construir un chatbot de Telegram integrando Gemini Pro AI y Google Docs
Este es unSupport Chatbot, AI Chatbot, Multimodal AIflujo de automatización del dominio deautomatización que contiene 9 nodos.Utiliza principalmente nodos como Wait, Telegram, GoogleDocsTool, SplitInBatches, HttpRequestTool. Construye un chatbot de Telegram que integra la IA Gemini Pro y Google Docs
- •Bot Token de Telegram
- •Pueden requerirse credenciales de autenticación para la API de destino
Nodos utilizados (9)
{
"meta": {
"instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
"name": "Enviar un mensaje a un modelo",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
4800,
1232
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-pro",
"cachedResultName": "models/gemini-2.5-pro"
},
"options": {},
"messages": {
"values": [
{
"content": "Replay test write user-friendly."
}
]
}
},
"typeVersion": 1
},
{
"id": "fbd4e562-fb5a-4e85-9814-75e4a9df2900",
"name": "Enviar un mensaje de texto",
"type": "n8n-nodes-base.telegram",
"position": [
5216,
1232
],
"webhookId": "3111e55e-41d3-4e3b-863c-bfda700bba92",
"parameters": {
"text": "={{ $json.content.parts[0].text }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"replyMarkup": "replyKeyboard",
"additionalFields": {},
"replyKeyboardOptions": {}
},
"typeVersion": 1.2
},
{
"id": "98b5b120-ab55-47b2-8f0d-0bc29b32bb7f",
"name": "Obtener un documento en Google Docs",
"type": "n8n-nodes-base.googleDocsTool",
"position": [
5184,
1488
],
"parameters": {
"simple": false,
"operation": "get",
"documentURL": "https://docs.google.com/document/d/19vaCViYaFkjFM6azAMf6fH6tDL2cwSsjTE5vX3eK6Ss"
},
"typeVersion": 2
},
{
"id": "c3df74b4-6077-4383-9c23-2f7505cea1fe",
"name": "Disparador de Telegram",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
4224,
1216
],
"webhookId": "05fcff6f-5e32-4599-9b29-c585878352d8",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "41eee1be-dfb9-4e7d-b659-a9de0e740e7a",
"name": "Esperar 1s",
"type": "n8n-nodes-base.wait",
"position": [
5488,
1232
],
"webhookId": "8223d68f-b3b2-4c42-a6d2-473a19e2904c",
"parameters": {
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "3dc90867-9946-4143-aeb9-a096993486c5",
"name": "Enviar un mensaje a un modelo en Google Gemini",
"type": "@n8n/n8n-nodes-langchain.googleGeminiTool",
"position": [
4992,
1488
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.0-flash-exp",
"cachedResultName": "models/gemini-2.0-flash-exp"
},
"options": {},
"messages": {
"values": [
{
"content": "Replay test write user-friendly."
}
]
}
},
"typeVersion": 1
},
{
"id": "0049c3fc-f6a2-420f-b0ca-c7330021a405",
"name": "Solicitud HTTP",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
4768,
1488
],
"parameters": {
"url": "https://devcodejourney.com/",
"options": {},
"toolDescription": "Replay test write user-friendly."
},
"typeVersion": 4.2
},
{
"id": "162fb82a-9ced-401a-a67e-6c4d3b84d118",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
2544,
1184
],
"parameters": {
"width": 1552,
"height": 2352,
"content": "# 🤖 Telegram + Gemini + Google Docs Automation in n8n\n\n## 📌 Overview\n\nThis n8n workflow listens for messages sent to a Telegram bot and replies with AI-generated responses using **Google Gemini (PaLM)**. It optionally interacts with **Google Docs** to fetch documents and makes external API requests using an **HTTP Request** node.\n\nThe flow also includes batching and waiting logic to control the pace of replies, making it scalable and human-friendly.\n\n---\n\n## 🧠 What This Workflow Does\n\n### ✅ 1. Trigger from Telegram\n- **Node**: `Telegram Trigger`\n- **Function**: Starts the workflow when a message is received via your Telegram bot.\n\n### ✅ 2. Loop Through Messages\n- **Node**: `Loop Over Items`\n- **Function**: Allows processing multiple incoming messages if required, using batching logic.\n\n### ✅ 3. AI-Powered Reply with Gemini\n- **Node**: `Message a model` (Google Gemini Pro)\n- **Function**: Sends the message to the Gemini AI (via Google PaLM API) to generate a human-friendly, conversational response.\n\n### ✅ 4. Send AI Response via Telegram\n- **Node**: `Send a text message`\n- **Function**: Sends the generated Gemini response back to the user on Telegram.\n\n### ✅ 5. Delay Between Replies\n- **Node**: `Wait 1s`\n- **Function**: Adds a 1-second delay before proceeding to the next message in the loop (helps avoid Telegram rate limits and creates more natural pacing).\n\n### ✅ 6. Optional: External API Request\n- **Node**: `HTTP Request`\n- **Function**: Makes an external API request to `https://devcodejourney.com/` (placeholder URL).\n- **Note**: Currently not connected to message flow but can be used to fetch or send additional data.\n\n### ✅ 7. Optional: Fetch Document from Google Docs\n- **Node**: `Get a document in Google Docs`\n- **Function**: Retrieves the contents of a Google Docs document from a provided link. Can be used to add static text, FAQs, or templates to the conversation.\n\n### ✅ 8. Optional: Alternate Gemini Tool\n- **Node**: `Message a model in Google Gemini`\n- **Function**: Uses a different version (`gemini-2.0-flash-exp`) of the Gemini AI model for fast responses or testing purposes.\n\n---\n\n## 🔧 Technologies Used\n\n- **Telegram Bot API** – for message triggers and replies \n- **Google Gemini (PaLM API)** – for AI-generated responses \n- **Google Docs API** – to fetch document content \n- **HTTP Request** – to connect to any third-party API \n- **n8n** – no-code/low-code workflow automation platform \n\n---\n\n## ⚙️ Use Cases\n\n- AI Chatbot for Telegram using Gemini \n- Personal Assistant or FAQ bot reading from Google Docs \n- Customer service bot that replies in natural language \n- Looping conversations with controlled pacing \n- External data fetching with AI processing \n\n---\n\n## 📌 Notes\n\n- Make sure you have the correct credentials configured in n8n for:\n - Telegram Bot\n - Google Docs OAuth2\n - Google Gemini API (PaLM)\n- You can add error-handling nodes or conditionals to expand the logic.\n- This can be extended into a full AI chatbot or customer support bot.\n\n---\n\n## 🧩 Nodes Used\n\n| Node Name | Type | Purpose |\n|-----------------------------------|----------------------------|-----------------------------------------|\n| Telegram Trigger | telegramTrigger | Listens for incoming Telegram messages |\n| Loop Over Items | splitInBatches | Handles batching of incoming data |\n| Message a model | langchain.googleGemini | Sends prompt to Google Gemini (Pro) |\n| Send a text message | telegram | Sends response back to Telegram user |\n| Wait 1s | wait | Adds a delay between responses |\n| HTTP Request | httpRequestTool | Sends HTTP request to external API |\n| Get a document in Google Docs | googleDocsTool | Fetches content from Google Docs |\n| Message a model in Google Gemini | googleGeminiTool | Alternate Gemini model for responses |\n\n---\n"
},
"typeVersion": 1
},
{
"id": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
"name": "Iterar sobre elementos 1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
4480,
1216
],
"parameters": {
"options": {}
},
"typeVersion": 3
}
],
"pinData": {},
"connections": {
"41eee1be-dfb9-4e7d-b659-a9de0e740e7a": {
"main": [
[
{
"node": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"ai_tool": [
[
{
"node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
"type": "ai_tool",
"index": 0
}
]
]
},
"17ac7115-a306-40bf-8b4a-9ce66ebbe3f1": {
"main": [
[
{
"node": "fbd4e562-fb5a-4e85-9814-75e4a9df2900",
"type": "main",
"index": 0
}
]
]
},
"9c16c31f-95db-40ab-aa8d-37750b123d2a": {
"main": [
[],
[
{
"node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
"type": "main",
"index": 0
}
]
]
},
"fbd4e562-fb5a-4e85-9814-75e4a9df2900": {
"main": [
[
{
"node": "41eee1be-dfb9-4e7d-b659-a9de0e740e7a",
"type": "main",
"index": 0
}
]
]
},
"98b5b120-ab55-47b2-8f0d-0bc29b32bb7f": {
"ai_tool": [
[
{
"node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
"type": "ai_tool",
"index": 0
}
]
]
},
"3dc90867-9946-4143-aeb9-a096993486c5": {
"ai_tool": [
[
{
"node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Intermedio - Chatbot de soporte, Chatbot de IA, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
DevCode Journey
@devcodejourneyI build intelligent systems that automate tasks, streamline workflows, and enhance user experiences using tools like n8n, AI chatbots, and modern automation platforms. With a passion for solving real-world problems through smart technology, I create custom solutions that help individuals and businesses save time, scale faster, and work smarter. Whether it's integrating APIs, building no-code/low-code automations, or developing conversational AI, I'm always exploring the edge of what's possible.
Compartir este flujo de trabajo