Análisis de imágenes de Telegram con GPT-4o Vision y extracción de texto

Avanzado

Este es unDocument Extraction, Multimodal AIflujo de automatización del dominio deautomatización que contiene 16 nodos.Utiliza principalmente nodos como Code, Telegram, HttpRequest, ExtractFromFile, TelegramTrigger. Analizar imágenes y extraer texto con GPT-4o Vision y Telegram

Requisitos previos
  • Bot Token de Telegram
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "355b2d103ad4834400263e78c73e64bbdb709c896780479c01a9ab9ccd7df6cf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "fe8f2304-f2f6-45d5-8f26-3e07f59f2122",
      "name": "Nota adhesiva — Descripción general",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        944
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 496,
        "content": "# 📸 Telegram → AIMLAPI Vision Bot\n\nThis workflow receives photos from users in Telegram, \nencodes them to base64, and sends them to **AIMLAPI** \n(GPT-4o Vision) for analysis.\n\n---\n## 🚀 Features\n* Image content recognition\n* OCR (extract text from photos)\n* Concise description in the reply\n* Automatic response back to Telegram\n"
      },
      "typeVersion": 1
    },
    {
      "id": "fc3443dd-7c1d-478f-846b-e20b2d480898",
      "name": "Nota adhesiva — Guía de configuración",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2320,
        944
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 496,
        "content": "# 🛠 Setup Guide\n\n### 1. 📲 Create a Telegram Bot\n* In [@BotFather](https://t.me/BotFather) → /newbot\n* Save the API Token\n\n### 2. 🔐 Connect Telegram API in n8n\n* Go to Credentials → Telegram API\n* Paste the token from BotFather\n\n### 3. 🔌 Connect AIMLAPI\n* Go to Credentials → AI/ML API\n* Enter your API Key\n* Base URL: https://api.aimlapi.com/v1\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a00ee4eb-0c89-48a2-87c1-000197b71a55",
      "name": "Nota adhesiva — Recibir mensaje",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        1552
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 448,
        "content": "# 📥 Step 1 — Receive Telegram Message\n\nListens for new messages in Telegram.\nExtracts:\n* chat.id (where to reply)\n* photo.file_id (photo file ID)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "375019d6-a2c0-438c-950c-376603599dc5",
      "name": "Nota adhesiva — Procesamiento GPT‑5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        1552
      ],
      "parameters": {
        "width": 384,
        "height": 448,
        "content": "# 📷 Step 2 — Get Photo\n\nFetches the file by `file_id` from Telegram.\nResult: binary photo data (jpg/jpeg/png).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e58d2186-f12e-43a4-9b7c-a644d27e64fa",
      "name": "Nota adhesiva — Enviar respuesta",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        1552
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 448,
        "content": "# 🧩 Step 3 — Convert to base64\n\nConverts the binary file into a base64 string,\nwhich will be passed to AIMLAPI Vision.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "06a31bfb-15af-40fe-b468-057cf985180f",
      "name": "Nota adhesiva — Registro",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2944,
        1552
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 448,
        "content": "# 🧠 Step 4 — AIMLAPI Vision\n\nMakes a request to AIMLAPI GPT-4o with:\n1. Instruction: \"Describe this image. Extract visible text.\"\n2. The base64 image passed as `image_url`.\n\nResult: description + OCR text.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7cc29371-2e04-440c-baea-4f7a716a5acf",
      "name": "Nota adhesiva — Recibir mensaje1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        1552
      ],
      "parameters": {
        "color": 3,
        "width": 384,
        "height": 448,
        "content": "# 💬 Step 1.5 — Simulate Typing\n\nSends a \"typing…\" action to the user\nwhile the bot processes the photo.\n\nCreates a more natural user experience.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3eb41a97-ae1e-45df-8699-99c7db819cf0",
      "name": "Nota adhesiva — Enviar respuesta1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2544,
        1552
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 448,
        "content": "# 🧑‍💻 Step 3.5 — Normalize MIME\n\nJS code builds a proper Data URI:\n`data:image/jpeg;base64,...`\n\nTelegram sometimes returns `image/jpg` — \nthis is replaced with the standard `image/jpeg`.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d616db57-d547-42b7-8b75-d41d769ad814",
      "name": "Nota adhesiva — Registro1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3344,
        1552
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 448,
        "content": "# 📤 Step 5 — Send Reply\n\nSends the model’s response back to the user \nin Telegram as a text message/caption.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d9b3cdf6-096d-426a-811b-9b35fa15f759",
      "name": "Paso 1 · 📩 Disparador Telegram (Entrada)",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        1072,
        1824
      ],
      "webhookId": "36951b18-32a3-4bd5-9fd5-be7ec180114f",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "969d9b61-fcab-4907-b670-ef12da530051",
      "name": "Paso 1.5 · 💬 Escribiendo…",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1472,
        1824
      ],
      "webhookId": "a048d256-da8b-4302-bc9c-ad03955ef7af",
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e24fb8ae-5090-45b4-bc77-4d2ddb054245",
      "name": "Paso 2 · 📷 Obtener foto",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1888,
        1824
      ],
      "webhookId": "94d3ad2f-9d08-414e-a323-7e56904768cf",
      "parameters": {
        "fileId": "={{ $('Step 1 · 📩 Telegram Trigger (In)').item.json.message.photo[$('Step 1 · 📩 Telegram Trigger (In)').item.json.message.photo.length - 1].file_id }}",
        "resource": "file",
        "additionalFields": {
          "mimeType": "image/jpeg"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "34e8b41b-ccd9-431c-92a0-0b1471295c55",
      "name": "Paso 3 · 🧩 Extraer → base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2288,
        1824
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "3cc458c3-ff28-4d34-9e40-769fa229f8ff",
      "name": "Paso 3.5 · 🧑‍💻 Construir URI de datos",
      "type": "n8n-nodes-base.code",
      "position": [
        2672,
        1824
      ],
      "parameters": {
        "jsCode": "// Build a proper Data URI for Vision API\n// Base64 from previous node\nconst base64Data = $input.first().json.data;;\n\n// Telegram may report image/jpg; normalize to image/jpeg\nlet fixedMime = 'image/jpeg';\n\nreturn [{\n  dataUri: `data:${fixedMime};base64,${base64Data}`\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "dbc396b9-d19a-4f7a-a26a-77b60d3cc9bc",
      "name": "Paso 4 · 🧠 AIMLAPI Vision (HTTP)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3088,
        1824
      ],
      "parameters": {
        "url": "https://api.aimlapi.com/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"openai/gpt-4o\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"Describe this image. Then extract any visible text (OCR). Keep it concise.\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"{{ $json.dataUri }}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": 300\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "aimlApi"
      },
      "credentials": {
        "aimlApi": {
          "id": "EXXHjMACiSMAhuC8",
          "name": "AI/ML account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "ca71edf8-19e8-4f9f-acbb-506a1bcb0240",
      "name": "Paso 5 · 📤 Responder a Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3488,
        1824
      ],
      "webhookId": "78700f84-9668-4cf2-afb4-8e771a8c9d6a",
      "parameters": {
        "text": "={{ $json?.choices?.[0]?.message?.content || \"Sorry, the model returned an empty response.\" }}",
        "chatId": "={{ $('Step 1 · 📩 Telegram Trigger (In)').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $('Step 1 · 📩 Telegram Trigger (In)').item.json.message.message_id }}",
          "disable_web_page_preview": true
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "cFC7gGbzU7PQGk6J",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "e24fb8ae-5090-45b4-bc77-4d2ddb054245": {
      "main": [
        [
          {
            "node": "34e8b41b-ccd9-431c-92a0-0b1471295c55",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "969d9b61-fcab-4907-b670-ef12da530051": {
      "main": [
        [
          {
            "node": "e24fb8ae-5090-45b4-bc77-4d2ddb054245",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "34e8b41b-ccd9-431c-92a0-0b1471295c55": {
      "main": [
        [
          {
            "node": "3cc458c3-ff28-4d34-9e40-769fa229f8ff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d9b3cdf6-096d-426a-811b-9b35fa15f759": {
      "main": [
        [
          {
            "node": "969d9b61-fcab-4907-b670-ef12da530051",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dbc396b9-d19a-4f7a-a26a-77b60d3cc9bc": {
      "main": [
        [
          {
            "node": "ca71edf8-19e8-4f9f-acbb-506a1bcb0240",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3cc458c3-ff28-4d34-9e40-769fa229f8ff": {
      "main": [
        [
          {
            "node": "dbc396b9-d19a-4f7a-a26a-77b60d3cc9bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿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.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos16
Categoría2
Tipos de nodos6
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34