Gestor inteligente de archivos de Telegram (integración de Drive + OCR)
Este es unDocument Extraction, Multimodal AIflujo de automatización del dominio deautomatización que contiene 33 nodos.Utiliza principalmente nodos como If, Set, Merge, Airtable, Telegram. Usar Telegram, Drive, OCR y Airtable para construir un archivo de documentos searchable
- •Clave de API de Airtable
- •Bot Token de Telegram
- •Credenciales de API de Google Drive
- •Pueden requerirse credenciales de autenticación para la API de destino
Nodos utilizados (33)
{
"id": "6D7Qa7LGmBt8ka3g",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "Telegram Smart File Manager (Drive + OCR Integration)",
"tags": [],
"nodes": [
{
"id": "b1414d19-9d49-480b-be77-6d8709c86919",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"notes": "Receives all incoming messages and documents from Telegram bot",
"position": [
-1264,
272
],
"webhookId": "telegram-smart-file-manager",
"parameters": {
"updates": [
"message",
"edited_message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3ubbGgZx2YzylQZu",
"name": "Telegram account - test"
}
},
"typeVersion": 1.1
},
{
"id": "ae8100e3-c852-48a3-a564-f8d1524439cc",
"name": "Verificar si es Archivo/Imagen",
"type": "n8n-nodes-base.if",
"notes": "Filters messages to process only documents and images",
"position": [
-1040,
272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"conditions": [
{
"id": "condition-001",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.document }}",
"rightValue": ""
},
{
"id": "condition-002",
"operator": {
"type": "object",
"operation": "exists"
},
"leftValue": "={{ $json.message.photo }}",
"rightValue": "",
"combineOperation": "or"
}
],
"combineOperation": "any"
}
},
"typeVersion": 2
},
{
"id": "0c28e059-5e63-4107-b8c9-02074ed7b7ca",
"name": "Sticky: Verificar Archivo",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1104,
144
],
"parameters": {
"color": 3,
"width": 200,
"height": 288,
"content": "🔍 **Filter**: Only proceed if message has file or image"
},
"typeVersion": 1
},
{
"id": "5c25a662-adbc-44cb-a3ef-678aff284c6d",
"name": "Extraer Metadatos del Archivo",
"type": "n8n-nodes-base.set",
"notes": "Extracts file ID, name, type and user info for processing",
"position": [
-816,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "assign-001",
"name": "fileId",
"type": "string",
"value": "={{ $json.message.document?.file_id || $json.message.photo?.slice(-1)[0].file_id }}"
},
{
"id": "assign-002",
"name": "fileName",
"type": "string",
"value": "={{ $json.message.document?.file_name || 'image_' + $json.message.date + '.jpg' }}"
},
{
"id": "assign-003",
"name": "mimeType",
"type": "string",
"value": "={{ $json.message.document?.mime_type || 'image/jpeg' }}"
},
{
"id": "assign-004",
"name": "chatId",
"type": "number",
"value": "={{ $json.message.chat.id }}"
},
{
"id": "assign-005",
"name": "userName",
"type": "string",
"value": "={{ $json.message.from.first_name }} {{ $json.message.from.last_name || '' }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "5007396a-0dcf-4c74-ac08-eab12479ef61",
"name": "Sticky: Extraer Metadatos",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
0
],
"parameters": {
"color": 2,
"width": 210,
"height": 304,
"content": "📋 **Extract**: fileId, name, MIME, chat & user info"
},
"typeVersion": 1
},
{
"id": "79240107-39e4-4185-9cd2-d015b2fd2a39",
"name": "Descargar Archivo desde Telegram",
"type": "n8n-nodes-base.telegram",
"notes": "Downloads the actual file content from Telegram servers",
"position": [
-608,
160
],
"webhookId": "2d85c25f-c520-4504-a788-2ed08dfce7aa",
"parameters": {
"fileId": "qwryuu75ewrjh",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3ubbGgZx2YzylQZu",
"name": "Telegram account - test"
}
},
"typeVersion": 1.1
},
{
"id": "76a9187c-768d-40d9-97b0-4e93d2b09e40",
"name": "Sticky: Descargar Archivo",
"type": "n8n-nodes-base.stickyNote",
"position": [
-656,
-16
],
"parameters": {
"width": 220,
"height": 320,
"content": "⬇️ **Download**: Get file binary from Telegram API"
},
"typeVersion": 1
},
{
"id": "b1a86b46-e69b-41cb-90b4-8c9bef5e4e59",
"name": "Subir a Google Drive",
"type": "n8n-nodes-base.googleDrive",
"notes": "Uploads file to Google Drive and returns Drive file ID",
"position": [
-384,
160
],
"parameters": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "MGnTMJvH7MB4xBS9",
"name": "Google Drive account - test"
}
},
"typeVersion": 3
},
{
"id": "5695fd86-ddd8-40a1-ad2d-90debbc441bb",
"name": "Sticky: Subir a Drive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-432,
-16
],
"parameters": {
"color": 5,
"width": 220,
"height": 320,
"content": "☁️ **Upload**: Save file to Google Drive root"
},
"typeVersion": 1
},
{
"id": "399a6769-627f-40b8-b2ea-c82a8c32eea9",
"name": "Verificar si es Elegible para OCR",
"type": "n8n-nodes-base.if",
"notes": "Determines if file type supports OCR (images and PDFs)",
"position": [
-160,
160
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"conditions": [
{
"id": "ocr-condition-001",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $json.mimeType }}",
"rightValue": "image/"
},
{
"id": "ocr-condition-002",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.mimeType }}",
"rightValue": "application/pdf",
"combineOperation": "or"
}
],
"combineOperation": "any"
}
},
"typeVersion": 2
},
{
"id": "4fbd99c5-1138-41e6-ac76-1e37b179330e",
"name": "Sticky: Elegible para OCR",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-16
],
"parameters": {
"color": 3,
"width": 200,
"height": 320,
"content": "🧠 **OCR Check**: Is it image or PDF?"
},
"typeVersion": 1
},
{
"id": "c0310c17-5f48-4646-ae7e-6bbef0ef4504",
"name": "Google Vision OCR",
"type": "n8n-nodes-base.httpRequest",
"notes": "Performs OCR using Google Vision API to extract text from images",
"position": [
64,
64
],
"parameters": {
"url": "=https://vision.googleapis.com/v1/images:annotate",
"options": {},
"sendBody": true,
"authentication": "oAuth2",
"bodyParameters": {
"parameters": [
{
"name": "requests",
"value": "=[{\"image\":{\"content\":\"{{ $('Download File from Telegram').item.binary.data.data }}\"},\"features\":[{\"type\":\"TEXT_DETECTION\"}]}]"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "75dd9b9d-a291-4122-a6cd-98a09dc88fe7",
"name": "Sticky: Vision OCR",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-80
],
"parameters": {
"color": 6,
"width": 220,
"height": 320,
"content": "🔍 **OCR**: Extract text via Google Vision API"
},
"typeVersion": 1
},
{
"id": "352815cf-6eda-4ac2-8e1e-de2f04975c56",
"name": "Extraer Texto OCR",
"type": "n8n-nodes-base.set",
"notes": "Parses OCR results and extracts detected text content",
"position": [
272,
64
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "extract-text-001",
"name": "extractedText",
"type": "string",
"value": "={{ $json.responses[0]?.fullTextAnnotation?.text || 'No text detected' }}"
},
{
"id": "extract-text-002",
"name": "confidence",
"type": "string",
"value": "={{ $json.responses[0]?.fullTextAnnotation ? 'High' : 'None' }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "9ada9e69-ac35-4b83-a028-3f1f3e182cf0",
"name": "Sticky: Extraer Texto OCR",
"type": "n8n-nodes-base.stickyNote",
"position": [
224,
-160
],
"parameters": {
"color": 2,
"width": 220,
"height": 352,
"content": "✂️ **Parse**: Get fullTextAnnotation from OCR response"
},
"typeVersion": 1
},
{
"id": "6d4867d7-32ef-4b1a-b219-fbbe4a06b2a0",
"name": "OCR No Necesario",
"type": "n8n-nodes-base.set",
"notes": "Sets default values for files that don't need OCR processing",
"position": [
64,
272
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "no-ocr-001",
"name": "extractedText",
"type": "string",
"value": "Not applicable for this file type"
},
{
"id": "no-ocr-002",
"name": "confidence",
"type": "string",
"value": "N/A"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "e3179bd4-e6d9-4931-8133-d9856a2ddbf2",
"name": "Sticky: Sin OCR",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
400
],
"parameters": {
"color": 7,
"width": 200,
"height": 240,
"content": "➖ **Skip OCR**: Non-image/PDF files"
},
"typeVersion": 1
},
{
"id": "d4cbfc85-2c1e-4b18-92ce-9d245caefc77",
"name": "Unir Rutas OCR",
"type": "n8n-nodes-base.merge",
"notes": "Combines results from OCR and non-OCR processing paths",
"position": [
400,
160
],
"parameters": {},
"typeVersion": 2.1
},
{
"id": "ba51bc68-77df-4727-9bb3-11febae993cc",
"name": "Indexar en Airtable",
"type": "n8n-nodes-base.airtable",
"notes": "Stores file metadata and extracted text in searchable Airtable database",
"position": [
624,
160
],
"parameters": {
"base": {
"__rl": true,
"mode": "id",
"value": "juu7654retyu"
},
"table": {
"__rl": true,
"mode": "id",
"value": "6ikkiu654erfghyt54321q"
},
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "create"
},
"credentials": {
"airtableTokenApi": {
"id": "ZtCtLnlIDAwG9TWC",
"name": "Airtable - test"
}
},
"typeVersion": 2
},
{
"id": "838b0f5b-987d-4d35-b03e-e21e71bd8183",
"name": "Sticky: Índice Airtable",
"type": "n8n-nodes-base.stickyNote",
"position": [
544,
80
],
"parameters": {
"color": 8,
"width": 230,
"height": 224,
"content": "📊 **Index**: Save metadata + OCR text to Airtable"
},
"typeVersion": 1
},
{
"id": "aa68c4ad-3bbc-4d71-b822-7a4eb988eba2",
"name": "Enviar Mensaje de Éxito",
"type": "n8n-nodes-base.telegram",
"notes": "Sends confirmation message to user with file details and preview",
"position": [
848,
160
],
"webhookId": "e2e530f0-c122-4f94-984f-c6c05046c838",
"parameters": {
"text": "=✅ **File Uploaded Successfully!**\n\n📁 **File:** {{ $json.fileName }}\n🔗 **Drive Link:** {{ $('Upload to Google Drive').item.json.webViewLink }}\n📝 **Extracted Text:** {{ $json.extractedText.substring(0, 200) }}{{ $json.extractedText.length > 200 ? '...' : '' }}\n⏰ **Uploaded:** {{ $now.format('yyyy-MM-dd HH:mm') }}",
"chatId": "={{ $json.chatId }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "3ubbGgZx2YzylQZu",
"name": "Telegram account - test"
}
},
"typeVersion": 1.1
},
{
"id": "5a85d261-8535-4024-aa0a-d13508ab68b0",
"name": "Sticky: Mensaje de Éxito",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
16
],
"parameters": {
"color": 4,
"width": 220,
"height": 288,
"content": "✅ **Notify**: Success message with link & preview"
},
"typeVersion": 1
},
{
"id": "247f8290-8372-41b6-af93-d50004d49a27",
"name": "Enviar Mensaje de Error",
"type": "n8n-nodes-base.telegram",
"notes": "Notifies user if any error occurs during processing",
"position": [
848,
368
],
"webhookId": "ca690436-1dd4-4477-91d8-e74cb33d07a0",
"parameters": {
"text": "❌ **Error Processing File**\n\nSorry, something went wrong while processing your file. Please try again later.",
"chatId": "={{ $json.chatId }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3ubbGgZx2YzylQZu",
"name": "Telegram account - test"
}
},
"typeVersion": 1.1
},
{
"id": "6c943962-95b5-40c0-8492-daa5a5421bbf",
"name": "Sticky: Mensaje de Error",
"type": "n8n-nodes-base.stickyNote",
"position": [
768,
528
],
"parameters": {
"width": 200,
"height": 70,
"content": "❌ **Error**: Notify user on failure"
},
"typeVersion": 1
},
{
"id": "d645926d-5289-4878-b6fd-12d6e7b0490b",
"name": "Verificar Comando de Búsqueda",
"type": "n8n-nodes-base.if",
"notes": "Detects if user wants to search indexed files using /search command",
"position": [
-816,
464
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"conditions": [
{
"id": "search-condition-001",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $json.message.text }}",
"rightValue": "/search "
}
],
"combineOperation": "any"
}
},
"typeVersion": 2
},
{
"id": "9328c7e3-6c2b-4d0c-897f-0cbf92c61ce8",
"name": "Sticky: Comando Búsqueda",
"type": "n8n-nodes-base.stickyNote",
"position": [
-944,
592
],
"parameters": {
"color": 3,
"width": 200,
"height": 70,
"content": "🔎 **Detect**: /search <query> command"
},
"typeVersion": 1
},
{
"id": "56783c48-c377-4415-90b2-66f6793196ef",
"name": "Extraer Consulta de Búsqueda",
"type": "n8n-nodes-base.set",
"notes": "Extracts the search keywords from user's message",
"position": [
-608,
464
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "search-query-001",
"name": "searchQuery",
"type": "string",
"value": "={{ $json.message.text.replace('/search ', '').trim() }}"
},
{
"id": "search-chat-001",
"name": "chatId",
"type": "number",
"value": "={{ $json.message.chat.id }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "6da1bc77-fe2b-4d7d-af2f-96956d2ada79",
"name": "Sticky: Extraer Consulta",
"type": "n8n-nodes-base.stickyNote",
"position": [
-656,
592
],
"parameters": {
"color": 2,
"width": 210,
"height": 70,
"content": "✂️ **Parse**: Extract query after /search"
},
"typeVersion": 1
},
{
"id": "2a8429f9-89fe-4387-872d-fb6bc4702eac",
"name": "Buscar en Índice",
"type": "n8n-nodes-base.airtable",
"notes": "Searches indexed files for matching text content",
"position": [
-384,
464
],
"parameters": {
"base": {
"__rl": true,
"mode": "id",
"value": "vbhytrewsxcv"
},
"table": {
"__rl": true,
"mode": "id",
"value": "vcde456yuhgfdsz"
},
"options": {},
"operation": "search",
"filterByFormula": "=SEARCH(LOWER(\"{{ $json.searchQuery }}\"), LOWER({extracted_text}))"
},
"credentials": {
"airtableTokenApi": {
"id": "ZtCtLnlIDAwG9TWC",
"name": "Airtable - test"
}
},
"typeVersion": 2
},
{
"id": "e82131ab-bb70-41d1-a904-d0d088fb3c53",
"name": "Sticky: Buscar en Índice",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
384
],
"parameters": {
"color": 6,
"width": 230,
"height": 70,
"content": "🔍 **Search**: Airtable full-text in extracted_text"
},
"typeVersion": 1
},
{
"id": "81969e62-0c4b-43e4-ab04-d6d4c9978f7c",
"name": "Enviar Resultados de Búsqueda",
"type": "n8n-nodes-base.telegram",
"notes": "Returns search results with file links to user",
"position": [
-160,
464
],
"webhookId": "595d3b2f-567b-435e-88a5-0682165f9080",
"parameters": {
"text": "=🔍 **Search Results for:** \"{{ $json.searchQuery }}\"\n\n{{ $('Search in Index').all().map((item, i) => `${i + 1}. **${item.json.fields.file_name}**\\n🔗 ${item.json.fields.drive_file_url}\\n📝 Preview: ${item.json.fields.extracted_text?.substring(0, 100)}...\\n`).join('\\n') || 'No results found.' }}",
"chatId": "={{ $json.chatId }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "3ubbGgZx2YzylQZu",
"name": "Telegram account - test"
}
},
"typeVersion": 1.1
},
{
"id": "d7cafa5b-c77f-4cc7-bc80-36491aa20d4e",
"name": "Sticky: Resultados de Búsqueda",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
384
],
"parameters": {
"color": 4,
"width": 220,
"height": 70,
"content": "📋 **Results**: Send matched files with previews"
},
"typeVersion": 1
},
{
"id": "3896a4e4-efa1-42af-af9b-d1954ac06471",
"name": "Sticky: Trigger",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1344,
192
],
"parameters": {
"color": 4,
"width": 220,
"height": 224,
"content": "🎯 **Trigger**: Listens for new messages/documents from users"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "32fa1b16-0531-459e-a037-441d674eb57f",
"connections": {
"6d4867d7-32ef-4b1a-b219-fbbe4a06b2a0": {
"main": [
[
{
"node": "d4cbfc85-2c1e-4b18-92ce-9d245caefc77",
"type": "main",
"index": 1
},
{
"node": "247f8290-8372-41b6-af93-d50004d49a27",
"type": "main",
"index": 0
}
]
]
},
"d4cbfc85-2c1e-4b18-92ce-9d245caefc77": {
"main": [
[
{
"node": "ba51bc68-77df-4727-9bb3-11febae993cc",
"type": "main",
"index": 0
}
]
]
},
"2a8429f9-89fe-4387-872d-fb6bc4702eac": {
"main": [
[
{
"node": "81969e62-0c4b-43e4-ab04-d6d4c9978f7c",
"type": "main",
"index": 0
}
]
]
},
"352815cf-6eda-4ac2-8e1e-de2f04975c56": {
"main": [
[
{
"node": "d4cbfc85-2c1e-4b18-92ce-9d245caefc77",
"type": "main",
"index": 0
}
]
]
},
"b1414d19-9d49-480b-be77-6d8709c86919": {
"main": [
[
{
"node": "ae8100e3-c852-48a3-a564-f8d1524439cc",
"type": "main",
"index": 0
},
{
"node": "d645926d-5289-4878-b6fd-12d6e7b0490b",
"type": "main",
"index": 0
}
]
]
},
"c0310c17-5f48-4646-ae7e-6bbef0ef4504": {
"main": [
[
{
"node": "352815cf-6eda-4ac2-8e1e-de2f04975c56",
"type": "main",
"index": 0
}
]
]
},
"ba51bc68-77df-4727-9bb3-11febae993cc": {
"main": [
[
{
"node": "aa68c4ad-3bbc-4d71-b822-7a4eb988eba2",
"type": "main",
"index": 0
}
]
]
},
"ae8100e3-c852-48a3-a564-f8d1524439cc": {
"main": [
[
{
"node": "5c25a662-adbc-44cb-a3ef-678aff284c6d",
"type": "main",
"index": 0
}
]
]
},
"d645926d-5289-4878-b6fd-12d6e7b0490b": {
"main": [
[
{
"node": "56783c48-c377-4415-90b2-66f6793196ef",
"type": "main",
"index": 0
}
]
]
},
"56783c48-c377-4415-90b2-66f6793196ef": {
"main": [
[
{
"node": "2a8429f9-89fe-4387-872d-fb6bc4702eac",
"type": "main",
"index": 0
}
]
]
},
"399a6769-627f-40b8-b2ea-c82a8c32eea9": {
"main": [
[
{
"node": "c0310c17-5f48-4646-ae7e-6bbef0ef4504",
"type": "main",
"index": 0
}
],
[
{
"node": "6d4867d7-32ef-4b1a-b219-fbbe4a06b2a0",
"type": "main",
"index": 0
}
]
]
},
"5c25a662-adbc-44cb-a3ef-678aff284c6d": {
"main": [
[
{
"node": "79240107-39e4-4185-9cd2-d015b2fd2a39",
"type": "main",
"index": 0
}
]
]
},
"b1a86b46-e69b-41cb-90b4-8c9bef5e4e59": {
"main": [
[
{
"node": "399a6769-627f-40b8-b2ea-c82a8c32eea9",
"type": "main",
"index": 0
}
]
]
},
"79240107-39e4-4185-9cd2-d015b2fd2a39": {
"main": [
[
{
"node": "b1a86b46-e69b-41cb-90b4-8c9bef5e4e59",
"type": "main",
"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?
Avanzado - Extracción de documentos, 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
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
Compartir este flujo de trabajo