Lector de imágenes con Gemini OCR

Intermedio

Este es unDocument Extraction, Multimodal AIflujo de automatización del dominio deautomatización que contiene 8 nodos.Utiliza principalmente nodos como Set, Telegram, HttpRequest, ExtractFromFile, TelegramTrigger. Usar un bot de Telegram y Gemini 2.0 Flash OCR para extraer texto de imágenes

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
{
  "id": "XqNsiUSOpgO7PRPD",
  "meta": {
    "instanceId": "51be389492931e958da1ec3c4cc03c8044ac06dd89d9465126f3cdb442363742",
    "templateCredsSetupCompleted": true
  },
  "name": "Image Reader Gemini OCR",
  "tags": [],
  "nodes": [
    {
      "id": "fa672106-597a-43d6-b3c8-d7d73e9ad499",
      "name": "Disparador de Telegram",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -360,
        -140
      ],
      "webhookId": "9b8e55dc-1389-435a-95b3-030d7e30ebce",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "coZ5n0FecDwDueBA",
          "name": "@RuriImageReader_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "552d5953-2b1e-48ff-a39b-112cae330f32",
      "name": "Limpiar Datos de Entrada",
      "type": "n8n-nodes-base.set",
      "position": [
        -140,
        -140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c8cd1608-2326-401d-9c47-79a6a72f5fc7",
              "name": "chatID",
              "type": "number",
              "value": "={{ $json.message.chat.id }}"
            },
            {
              "id": "0f1a41cb-8630-4e10-b445-f6bbbcf91d33",
              "name": "Image",
              "type": "string",
              "value": "={{ $json[\"message\"][\"photo\"][$json[\"message\"][\"photo\"].length - 1][\"file_id\"] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4127fe82-7700-4292-b4fc-6fc27aa9e27c",
      "name": "Obtener archivo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        80,
        -140
      ],
      "webhookId": "b812a0c8-e5f5-4969-9fad-a7b5b6e72dd9",
      "parameters": {
        "fileId": "={{ $json.Image.replace(/\\n/g, '') }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "coZ5n0FecDwDueBA",
          "name": "@RuriImageReader_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cdee68db-f387-48d6-8b1c-2f1de0fbefea",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        80,
        120
      ],
      "webhookId": "8219e2f1-2393-40ee-9c84-88666b10d946",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Clean Input Data').item.json.chatID }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "coZ5n0FecDwDueBA",
          "name": "@RuriImageReader_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d9ef5251-9fb1-4810-aa78-4a393f4355e7",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -200
      ],
      "parameters": {
        "color": 4,
        "width": 920,
        "height": 620,
        "content": "## Image Reader"
      },
      "typeVersion": 1
    },
    {
      "id": "ecb87468-671d-484c-9baf-01d40e6f5de6",
      "name": "Gemini OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -360,
        120
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"inlineData\": {\n            \"mimeType\": \"image/jpeg\",\n            \"data\": \"{{ $json.data }}\"\n          }\n        },\n        {\n          \"text\": \"Extract text\"\n        }\n      ]\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth"
      },
      "credentials": {
        "httpQueryAuth": {
          "id": "wcX4Li4YomZJHh1s",
          "name": "Gemini API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2990b76a-536e-48b4-8202-21b82ead2ef1",
      "name": "Extraer de Archivo",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        320,
        -140
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "71b92a9e-8393-4f00-a99d-123ea4f3ed19",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -200
      ],
      "parameters": {
        "height": 1060,
        "content": "## HTTP Gemini OCR Setting\n\nDefine Gemini Model on URL\n\nhttps://generativelanguage.googleapis.com/v1beta/models/[Gemini Model]:generateContent\n\nexample:\nhttps://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent\n\n...\n\nAuthentication\nGeneric Credential Type\n\nGeneric Auth Type\nQuery Auth\n\nQuery Auth\n+ Create new credential (take if from https://aistudio.google.com/)\n\n...\n\nBody Content Type\nJSON\n\nSpecify Body\nUsing JSON\n\nJSON\n{\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"inlineData\": {\n            \"mimeType\": \"image/jpeg\",\n            \"data\": \"{{ $json.data }}\"\n          }\n        },\n        {\n          \"text\": \"Extract text\"\n        }\n      ]\n    }\n  ]\n}"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {
    "Telegram Trigger": [
      {
        "json": {
          "message": {
            "chat": {
              "id": 1335515855,
              "type": "private",
              "username": "VextCode",
              "first_name": "Vext"
            },
            "date": 1752202117,
            "from": {
              "id": 1335515855,
              "is_bot": false,
              "username": "VextCode",
              "first_name": "Vext",
              "language_code": "en"
            },
            "photo": [
              {
                "width": 90,
                "height": 47,
                "file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAANzAAM2BA",
                "file_size": 1128,
                "file_unique_id": "AQADw8oxG-eqiVd4"
              },
              {
                "width": 320,
                "height": 168,
                "file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAANtAAM2BA",
                "file_size": 18516,
                "file_unique_id": "AQADw8oxG-eqiVdy"
              },
              {
                "width": 800,
                "height": 420,
                "file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAAN4AAM2BA",
                "file_size": 73842,
                "file_unique_id": "AQADw8oxG-eqiVd9"
              },
              {
                "width": 1200,
                "height": 630,
                "file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAAN5AAM2BA",
                "file_size": 86132,
                "file_unique_id": "AQADw8oxG-eqiVd-"
              }
            ],
            "message_id": 125
          },
          "update_id": 413913388
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c571dd01-5b7e-4ee1-88d1-d33abb86e78b",
  "connections": {
    "4127fe82-7700-4292-b4fc-6fc27aa9e27c": {
      "main": [
        [
          {
            "node": "2990b76a-536e-48b4-8202-21b82ead2ef1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ecb87468-671d-484c-9baf-01d40e6f5de6": {
      "main": [
        [
          {
            "node": "cdee68db-f387-48d6-8b1c-2f1de0fbefea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "552d5953-2b1e-48ff-a39b-112cae330f32": {
      "main": [
        [
          {
            "node": "4127fe82-7700-4292-b4fc-6fc27aa9e27c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "552d5953-2b1e-48ff-a39b-112cae330f32",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2990b76a-536e-48b4-8202-21b82ead2ef1": {
      "main": [
        [
          {
            "node": "ecb87468-671d-484c-9baf-01d40e6f5de6",
            "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?

Intermedio - 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
Intermedio
Número de nodos8
Categoría2
Tipos de nodos6
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34