AutomationFlowsAI & RAG › Multimodal Telegram Bot with Voice, Image & Video Analysis Using Claude & Gemini

Multimodal Telegram Bot with Voice, Image & Video Analysis Using Claude & Gemini

ByKeith Uy @keithuy on n8n.io

This is a base template for anyone trying to develop a telegram AI Agent. This base allows for multiple inputs (Voice, Picture, Video, and Text inputs) to be processed by an AI model of their choosing to a get a User started. From here, the User may connect any tools that they…

Event trigger★★★★★ complexityAI-powered31 nodesTelegram TriggerAgentOpenAIMemory Buffer WindowDate Time ToolAnthropic ChatTelegramGoogle Gemini
AI & RAG Trigger: Event Nodes: 31 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #9008 — we link there as the canonical source.

This workflow follows the Agent → Googlegemini recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "EqwHkiMliEvlONN6",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram AI Agent Base",
  "tags": [],
  "nodes": [
    {
      "id": "fe57df5b-9bd6-4b89-9f2a-7e492f007ee6",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -16,
        224
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8f54add4-f32f-41a5-be2f-9602c8c0235e",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        224,
        176
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Do Nothing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "611dbffc-c663-48c9-9e10-c045f26f4505",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/start"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2c19aba8-aba2-4cf2-aefc-1f1af9277f5d",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "picture",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5e324898-f3d5-4a84-8ca4-94a33849cd6d",
                    "operator": {
                      "type": "array",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.photo }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "video",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7b448a1b-5f96-42e3-bfce-dad6b5c45f01",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.video }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e4174e28-530a-42ab-92f8-3ab0b79c7684",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/start"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ab6b3c42-8f87-4d9c-b446-467420ba89dc",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        544,
        -224
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0fe10676-1310-427c-af4c-c0d1553ffd7f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1424,
        144
      ],
      "parameters": {
        "text": "={{ $json[\"User Input\"] }}",
        "options": {
          "systemMessage": "You are a helpful, intelligent assistant.\n\nOutput ONLY a plain UTF-8 string for Telegram. \nNo JSON. No code fences. No prefaces. \nIf content is empty, output \"\u2026\"."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "91108b1b-d794-41bf-becc-df8fa7c5bf72",
      "name": "Transcribe a recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        784,
        16
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e93e0d43-cb1d-48e1-8677-4a6a70512e7b",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1536,
        448
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 50
      },
      "typeVersion": 1.3
    },
    {
      "id": "a9810f69-059a-49e6-93f2-54e7cd71ea66",
      "name": "Date & Time",
      "type": "n8n-nodes-base.dateTimeTool",
      "position": [
        1792,
        464
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "fdd5cb5d-3a2d-41f6-88db-ae13d8bd6507",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        1264,
        448
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude Sonnet 4"
        },
        "options": {
          "maxTokensToSample": 10000
        }
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d4d3204f-590e-4d7e-ba65-bfc8cab50c6b",
      "name": "Send Regular Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1776,
        144
      ],
      "parameters": {
        "text": "={{ $('AI Agent').item.json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b24c21d7-ba1a-460e-8575-3908e450d9ad",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 560,
        "content": "# INSTRUCTIONS\n\n## 1. Create your chat bot and generate access token\n-> Search Bot father in telegram\n-> \"/newbot\"\n-> follow instructions and create access token\n-> Copy access token\n\n## 2. Create Credentials in n8n\n-> Open telegram trigger node\n-> Click create credential\n-> Paste access token\n-> Save\n\n## 3. Create LLM access token\nDifferent per LLM but search your LLM + API in google\n-> (will have to create an account with the LLM platform)\n-> Buy credits to use LLM API\n-> Generate Access token\n-> Paste token in LLM node"
      },
      "typeVersion": 1
    },
    {
      "id": "a7c7769a-498a-43ed-bc54-f8d5df6f4b63",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 208,
        "height": 496,
        "content": "### Waits for telegram message to start workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "5b0a6572-dcb8-4607-8f68-7b1f57074c1d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 208,
        "height": 496,
        "content": "### Determines what type of message was sent"
      },
      "typeVersion": 1
    },
    {
      "id": "c90fc3ab-dfee-41de-9da0-2cedc8ae1a8b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 192,
        "height": 208,
        "content": "### Get Audio File"
      },
      "typeVersion": 1
    },
    {
      "id": "2d3fef65-2c63-4672-ba2e-dc8c4dce3050",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 208,
        "height": 208,
        "content": "### Use OpenAI to Transcribe Recording"
      },
      "typeVersion": 1
    },
    {
      "id": "98231e32-f8c9-4489-a190-c531beee462f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        352
      ],
      "parameters": {
        "width": 224,
        "height": 224,
        "content": "### Choose any LLM you want here"
      },
      "typeVersion": 1
    },
    {
      "id": "27be2872-1ff2-44f3-95df-aa9e2dcc2f37",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 288,
        "height": 368,
        "content": "### Base AI Agent. Adjust \"System Prompt\" to personalize this agent to your needs"
      },
      "typeVersion": 1
    },
    {
      "id": "1c156152-bd4d-4294-b462-2739ae45ca07",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 224,
        "height": 368,
        "content": "### Sends AI Agent output to you in Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "dd9c35a4-89dc-4c3d-9f22-ef3ca0d198dd",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        352
      ],
      "parameters": {
        "width": 208,
        "height": 224,
        "content": "### Choose # of messages the LLM can read back"
      },
      "typeVersion": 1
    },
    {
      "id": "8310f4e1-07f2-458a-8d41-a347aca32136",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        352
      ],
      "parameters": {
        "width": 224,
        "height": 224,
        "content": "### Add tools that the LLM has access to here"
      },
      "typeVersion": 1
    },
    {
      "id": "8779f8c2-1ab3-45a9-8787-0177b2b09534",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        224
      ],
      "parameters": {
        "color": 5,
        "width": 192,
        "height": 224,
        "content": "### Get Photo File"
      },
      "typeVersion": 1
    },
    {
      "id": "5fd1f209-90cf-4956-a029-b7fa86d4f4e0",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        224
      ],
      "parameters": {
        "color": 5,
        "width": 208,
        "height": 224,
        "content": "### Use Gemini to analyze photo"
      },
      "typeVersion": 1
    },
    {
      "id": "6a3a4517-dbef-4a21-83d1-55bd8f6f6970",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1040,
        112
      ],
      "parameters": {
        "numberInputs": 4
      },
      "typeVersion": 3.2
    },
    {
      "id": "6ec2e6c7-ebbd-4ad2-a74d-9078bd115b4d",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1232,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4f68c522-dd1e-45dc-ab39-f5b640bfe274",
              "name": "User Input",
              "type": "string",
              "value": "={{$json.text     || $json.message?.text     || $json.content     || $json[\"data\"]     || $json.result     || $json.transcription     || \"\"}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f63eda5b-4609-4e7c-9970-9b9e27a301c8",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 160,
        "height": 368,
        "content": "### Creates a unified input to pass to AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "ec2895ca-8912-4b4d-88e3-f6edd46e6a3c",
      "name": "Get a Audio File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        16
      ],
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f8290197-046a-448f-86d0-154fed593d21",
      "name": "Get a Photo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        304
      ],
      "parameters": {
        "fileId": "={{ $json.message.photo[0].file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a9af3fbf-5945-4f79-b994-95de3a9c924c",
      "name": "Get a Video File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        592
      ],
      "parameters": {
        "fileId": "={{ $json.message.video.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "262a8562-66ac-4834-b424-cbe36fad8a48",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        512
      ],
      "parameters": {
        "color": 5,
        "width": 192,
        "height": 240,
        "content": "### Get Video File"
      },
      "typeVersion": 1
    },
    {
      "id": "6a25a9e7-8839-4de4-b5f4-2d8d7ed63a44",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        512
      ],
      "parameters": {
        "color": 5,
        "width": 208,
        "height": 240,
        "content": "### Use Gemini to analyze Video"
      },
      "typeVersion": 1
    },
    {
      "id": "5ba18177-7feb-4455-976b-14f819f9c449",
      "name": "Analyze video",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        784,
        592
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.caption || $('Telegram Trigger').item.json.message.text }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "video",
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a418361f-6f9e-4c4b-ad56-4454b94e7660",
      "name": "Analyze an image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        784,
        304
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.caption || $('Telegram Trigger').item.json.message.text  }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "image",
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "437597a2-50e4-409b-b678-d3944d857352",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a Audio File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a Photo",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a Video File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Regular Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a Photo": {
      "main": [
        [
          {
            "node": "Analyze an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze video": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Analyze an image": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Get a Audio File": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a Video File": {
      "main": [
        [
          {
            "node": "Analyze video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This is a base template for anyone trying to develop a telegram AI Agent. This base allows for multiple inputs (Voice, Picture, Video, and Text inputs) to be processed by an AI model of their choosing to a get a User started. From here, the User may connect any tools that they…

Source: https://n8n.io/workflows/9008/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Personal Assistant. Uses memoryBufferWindow, agent, agentTool, httpRequestTool. Event-driven trigger; 77 nodes.

Memory Buffer Window, Agent, Agent Tool +15
AI & RAG

Automate your personal productivity with this intelligent n8n workflow that integrates Telegram, Google Sheets, and OpenAI (GPT-4o). This system uses multiple AI agents to manage work hours, tasks, fi

Agent, OpenAI Chat, Telegram +9
AI & RAG

Template Carnaval - time instagram. Uses toolWorkflow, lmChatOpenAi, memoryBufferWindow, agent. Event-driven trigger; 56 nodes.

Tool Workflow, OpenAI Chat, Memory Buffer Window +10
AI & RAG

This is a base template for anyone trying to develop a Slack bot AI Agent. This base allows for multiple inputs (Voice, Picture, Video, and Text inputs) to be processed by an AI model of their choosin

Agent, OpenAI, Memory Buffer Window +6
AI & RAG

This workflow turns Telegram into a personal task manager by using Anthropic Claude to create, update, list, and delete tasks stored in an n8n Data Table, while also sending scheduled daily task summa

Telegram Trigger, Agent, Anthropic Chat +4