GPT-4o Vision mit Telegram-Bildanalyse und Textextraktion

Experte

Dies ist ein Document Extraction, Multimodal AI-Bereich Automatisierungsworkflow mit 16 Nodes. Hauptsächlich werden Code, Telegram, HttpRequest, ExtractFromFile, TelegramTrigger und andere Nodes verwendet. Verwendung von GPT-4o Vision und Telegram zur Analyse von Bildern und zum Extrahieren von Text

Voraussetzungen
  • Telegram Bot Token
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "355b2d103ad4834400263e78c73e64bbdb709c896780479c01a9ab9ccd7df6cf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "fe8f2304-f2f6-45d5-8f26-3e07f59f2122",
      "name": "Haftnotiz — Überblick",
      "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": "Haftnotiz — Einrichtungsanleitung",
      "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": "Haftnotiz — Nachricht empfangen",
      "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": "Haftnotiz — GPT‑5 Verarbeitung",
      "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": "Haftnotiz — Antwort senden",
      "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": "Haftnotiz — Protokollierung",
      "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": "Haftnotiz — Nachricht empfangen1",
      "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": "Haftnotiz — Antwort senden1",
      "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": "Haftnotiz — Protokollierung1",
      "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": "Schritt 1 · 📩 Telegram Trigger (Eingang)",
      "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": "Schritt 1.5 · 💬 Tippen…",
      "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": "Schritt 2 · 📷 Foto abrufen",
      "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": "Schritt 3 · 🧩 Extrahieren → base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2288,
        1824
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "3cc458c3-ff28-4d34-9e40-769fa229f8ff",
      "name": "Schritt 3.5 · 🧑‍💻 Data URI erstellen",
      "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": "Schritt 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": "Schritt 5 · 📤 Antwort an 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
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Dokumentenextraktion, Multimodales KI

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes16
Kategorie2
Node-Typen6
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34