AutomationFlowsAI & RAG › AI-Powered Telegram Chatbot

AI-Powered Telegram Chatbot

Original n8n title: Telegram Bot

Telegram bot. Uses telegramTrigger, embeddingsOllama, lmChatOllama, toolVectorStore. Event-driven trigger; 26 nodes.

Event trigger★★★★☆ complexityAI-powered26 nodesTelegram TriggerOllama EmbeddingsOllama ChatTool Vector StoreQdrant Vector StoreMemory Postgres ChatMemory ManagerHTTP Request
AI & RAG Trigger: Event Nodes: 26 Complexity: ★★★★☆ AI nodes: yes Added:
AI-Powered Telegram Chatbot — n8n workflow card showing Telegram Trigger, Ollama Embeddings, Ollama Chat integration

This workflow follows the Agent → HTTP Request 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
{
  "name": "Telegram Bot",
  "nodes": [
    {
      "parameters": {
        "content": "## /start\nUn usuario se conecta al bot por primera vez",
        "height": 240,
        "width": 752
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        -224
      ],
      "id": "d4947764-5733-4caa-9acd-bae5506f40d4",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## text-message (Response text or generate an image)",
        "height": 256,
        "width": 1056,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        320
      ],
      "id": "5121a9e9-d851-492d-b175-b298a4f9b0f8",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=## Descripci\u00f3n\n- Eres un asistente que ayuda a las personas con cualquier tipo de consulta.\n- Tus respuestas deben de ser convincentes y usa entre 3 a 4 oraciones de acuerdo a la pregunta. \n- A veces recibir\u00e1s textos de im\u00e1genes previamente analizadas por otro AI, la respuesta no ha sido enviada al usuario, tu labor ser\u00eda enviarle ese mensaje al usuario.\n\n## Informaci\u00f3n previa de la imagen mediante AI\n{{ $json.ai }}\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        1072,
        736
      ],
      "id": "42d222dc-2f60-4740-bf64-67c8652eeda3",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1200,
        912
      ],
      "id": "11489942-11bc-4a40-bbf7-183d8887f423",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "content": "## AI Agent",
        "height": 368,
        "width": 336,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        992,
        688
      ],
      "id": "07a8c487-a21b-4858-b305-b28c467ef0c1",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## image-message (Edit or analyze image)",
        "height": 272,
        "width": 1568,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        32
      ],
      "id": "32ec950c-8224-4c01-b1e1-b38737e9252f",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## audio-message (Response audio)",
        "height": 224,
        "width": 1056,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        592
      ],
      "id": "f505e504-6e39-4da4-a8fe-5ac31500bee5",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "operation": "sendAudio",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "binaryData": true,
        "additionalFields": {
          "reply_to_message_id": "={{ $('Telegram Trigger').item.json.message.message_id }}"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1728,
        736
      ],
      "id": "0b6176cf-6541-4df6-a119-c5f77be86ce6",
      "name": "Send an audio file",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "speech",
        "voice": {
          "__rl": true,
          "value": "b2htR0pMe28pYwCY9gnP",
          "mode": "list",
          "cachedResultName": "Sof\u00eda \u2013 Soft & Warm"
        },
        "text": "={{ $json.output }}",
        "additionalOptions": {},
        "requestOptions": {}
      },
      "type": "@elevenlabs/n8n-nodes-elevenlabs.elevenLabs",
      "typeVersion": 1,
      "position": [
        1552,
        736
      ],
      "id": "f56326b3-f51a-4bbf-becf-e420a99de235",
      "name": "Convert text to speech",
      "credentials": {
        "elevenLabsApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "text": "={{ $('Telegram Trigger').item.json.message.caption || \"Qu\u00e9 hay en la imagen\" }}",
        "inputType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        1008,
        96
      ],
      "id": "31ed8ada-6a4f-4360-b0a8-94b245ec8c73",
      "name": "Analyze an image",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "audio",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "inputType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        304,
        640
      ],
      "id": "e3eb880e-a1f2-4b80-af01-d6ef29e9af27",
      "name": "Transcribe a recording",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "maxOutputTokens": 5000
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1056,
        896
      ],
      "id": "0e314b5a-7fa6-4ea5-9173-c59fb0f32b3b",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Generate image with Nano Banana\n",
        "height": 352,
        "width": 480,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        848,
        320
      ],
      "id": "56455c6f-9d7f-4267-826e-af5e790fd8fa",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "Eres un experto en analizar el prompt de un usuario.\nSolo debes responder en JSON.\nEl json solo debe tener la variable output.\nSi el prompt pide que se genera una imagen el valor de output es image.\nSi el prompt se pide que se modifique o edite una imagen el valor del output es edit.\nSi el prompt no pide que se genera una imagen el valor de output es text.",
              "role": "model"
            },
            {
              "content": "=Sollo debes responder la variable output en el JSON : \nPrompt : {{ $json.text }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        272,
        384
      ],
      "id": "b55885e5-ea42-45f4-af82-48dec9421ff8",
      "name": "Message a model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3e930d17-ff10-4374-87e3-c20fc65f4fa5",
              "name": "output",
              "value": "={{ $json.content.parts[0].text.parseJson().output }}",
              "type": "string"
            },
            {
              "id": "1cd4ff61-b0fe-45ec-adfb-3f8657337ed9",
              "name": "text",
              "value": "={{ $('Telegram Trigger').item.json.message.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        544,
        384
      ],
      "id": "c3b1c8fc-2cd6-4553-94fb-d21848d5940f",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "resource": "image",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash-image",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash-image (Nano Banana)"
        },
        "prompt": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        1024,
        512
      ],
      "id": "aaae2cf7-c5d7-4f29-b43b-ac4a0a55fb5b",
      "name": "Generate an image",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Send message (text or audio)",
        "height": 368,
        "width": 544,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1360,
        688
      ],
      "id": "05a6b8a7-3ece-4666-8ea7-bfc069928337",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "05e264e2-8dcf-4942-a5aa-5626ce064d10",
              "name": "output",
              "value": "={{ $json.content.parts[0].text.parseJson().output }}",
              "type": "string"
            },
            {
              "id": "01e043a0-2d48-42a6-b8e3-28ef0fed1496",
              "name": "text",
              "value": "={{ $('Telegram Trigger').item.json.message.caption || \"Qu\u00e9 hay en la imagen\" }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        448,
        112
      ],
      "id": "44fd9477-e12a-4bf6-9351-936f66262b66",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "edit",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash-image",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash-image (Nano Banana)"
        },
        "prompt": "={{ $('Edit Fields1').item.json.text }}",
        "images": {
          "values": [
            {}
          ]
        },
        "options": {
          "binaryPropertyOutput": "data"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        1024,
        368
      ],
      "id": "ea762448-1ad9-48fb-9e5b-eaa2d3c44b8d",
      "name": "Edit an image",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendPhoto",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1456,
        432
      ],
      "id": "dbe1a995-bbc2-44ca-9fb9-d2ba68d2fcc3",
      "name": "Send image edited",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.content.parts[0].text }}",
        "additionalFields": {
          "appendAttribution": false,
          "parse_mode": "HTML",
          "reply_to_message_id": "={{ $('Telegram Trigger').item.json.message.message_id }}"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1456,
        96
      ],
      "id": "d366abd9-eb9d-4062-a228-da58d73eada4",
      "name": "Send message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendChatAction",
        "chatId": "={{ $json.message.chat.id }}"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -160,
        112
      ],
      "id": "d159fbde-6efa-4d2f-b768-414629f75dff",
      "name": "Writing",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendChatAction",
        "chatId": "={{ $json.message.chat.id }}"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -112,
        384
      ],
      "id": "778b5392-5678-4a8b-8316-02b2c80c7d98",
      "name": "Writing2",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendChatAction",
        "chatId": "={{ $json.message.chat.id }}",
        "action": "record_audio"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -128,
        640
      ],
      "id": "04d309b7-5341-4c92-bc1b-7b4596534312",
      "name": "Recording audio",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"text\": \"{{ $('Telegram Trigger').item.json.message.text }}\",\n  \"type\": \"message\",\n  \"ai\" : \"\"\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        96,
        384
      ],
      "id": "7ebabd9d-3a40-4b0f-8333-4c8594ec4946",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "url": "https://api.giphy.com/v1/stickers/random?api_key=sf3pyd2bRhftbpxFKltG8M5IMb54FPhm&tag=hola&rating=pg",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -128,
        -144
      ],
      "id": "70be8da3-1092-49f3-a36a-898ebc515f44",
      "name": "Get sticker"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"text\": \"{{ $json.content.parts[0].text }}\",\n  \"type\": \"audio\",\n  \"ai\" : \"\"\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        544,
        640
      ],
      "id": "fce13d94-2903-4525-9634-02a8375a09a6",
      "name": "Edit Fields3"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "eba38021-44e6-4b74-998c-1f7b26aa5d8e",
              "leftValue": "={{ $('Union ways').item.json.type }}",
              "rightValue": "audio",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1376,
        752
      ],
      "id": "8e21cacb-6f43-441d-9188-c94803981f5b",
      "name": "Is an audio?"
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $('Telegram Trigger').item.json.message.message_id }}"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1552,
        880
      ],
      "id": "63665d27-f923-48fe-9173-5a189e0b1a4f",
      "name": "Send message1",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return {\n  \"text\" : $input.first().json.text,\n  \"type\" : $input.first().json.type,\n  \"ai\" : $input.first().json.ai\n}"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        864,
        736
      ],
      "id": "c7a2a1ad-3934-4052-95b8-4cd6f9f47dcc",
      "name": "Union ways"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        112,
        640
      ],
      "id": "4fbb5afc-ddda-478e-9426-08b97ad52b55",
      "name": "Download audio",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/start",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "9663a985-fca3-4d39-b5b3-11022bc5c318"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "/start"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "4cfcf46e-018b-411c-8a34-29de5f7ec978",
                    "leftValue": "={{ $json.message.photo }}",
                    "rightValue": "",
                    "operator": {
                      "type": "array",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "image-message"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c3e3ab0b-101d-45d4-8c93-7f35322c5486",
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "text-message"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "9d63b56c-4507-4a1a-9689-edc81781908c",
                    "leftValue": "={{ $json.message.voice }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "audio-message"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        -400,
        48
      ],
      "id": "f34cb2ad-d261-40b0-99b4-e61e88f09df2",
      "name": "Message type"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Telegram Trigger').item.json.message.photo[2].file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        608,
        112
      ],
      "id": "bf104495-37ce-4c19-b618-18d65b7a507d",
      "name": "Download image",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "Eres un experto en analizar el prompt de un usuario.\nSolo debes responder en JSON.\nEl json solo debe tener la variable output.\nSi el prompt se pide que se modifique o edite una imagen (por ejemplo que se a\u00f1ada algo a la imagen como un objeto, que se edite) el valor del output es edit.\nSi el prompt pide analizar la imagen el valor del output es analize.\nSi el prompt es vac\u00edo el valor del output es analize.",
              "role": "model"
            },
            {
              "content": "=Sollo debes responder la variable output en el JSON : \nPrompt : {{ $('Telegram Trigger').item.json.message.caption }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        160,
        112
      ],
      "id": "7899269a-128d-45df-8ced-8dff3ec36641",
      "name": "Generate output json",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -592,
        80
      ],
      "id": "e6a59562-68eb-45e5-852b-8c53ee298d78",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "df33e6dd-c4f4-4315-8c23-5ddbe384d809",
              "leftValue": "={{ $json.output }}",
              "rightValue": "image",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        704,
        384
      ],
      "id": "731b9bdd-5919-4de9-9025-b50dc918e360",
      "name": "Is image?"
    },
    {
      "parameters": {
        "content": "## Send image",
        "height": 640,
        "width": 304,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1360,
        32
      ],
      "id": "9327dc9d-4de2-4b72-8798-6cd1e9bfdfcb",
      "name": "Sticky Note7"
    },
    {
      "parameters": {
        "url": "={{ $json.data.images.original.url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        80,
        -144
      ],
      "id": "348dc026-b71d-417d-bc6d-92e42a1d1acb",
      "name": "Download welcome sticker"
    },
    {
      "parameters": {
        "operation": "sendSticker",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        320,
        -144
      ],
      "id": "74154d1f-869d-4667-8d2f-2d9a3d6fe712",
      "name": "Send welcome sticker",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return $('Telegram Trigger').first().json.message.photo[3] || $('Telegram Trigger').first().json.message.photo[2] || $('Telegram Trigger').first().json.message.photo[1] || $('Telegram Trigger').first().json.message.photo[0]"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        112
      ],
      "id": "04b7e678-33bc-4d08-a033-6a3818d38e5d",
      "name": "Select image"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "fa9bb54e-50af-4a02-ad5c-6b6a271140bc",
              "leftValue": "={{ $('Edit Fields1').item.json.output }}",
              "rightValue": "analyze",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        752,
        112
      ],
      "id": "a8d1c327-eee5-4ed8-b7a7-7e31d43cbc7e",
      "name": "Is analyze?"
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Is an audio?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert text to speech": {
      "main": [
        [
          {
            "node": "Send an audio file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze an image": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Is image?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "Send image edited",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Download image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit an image": {
      "main": [
        [
          {
            "node": "Send image edited",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Writing": {
      "main": [
        [
          {
            "node": "Select image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Writing2": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recording audio": {
      "main": [
        [
          {
            "node": "Download audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get sticker": {
      "main": [
        [
          {
            "node": "Download welcome sticker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields3": {
      "main": [
        [
          {
            "node": "Union ways",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is an audio?": {
      "main": [
        [
          {
            "node": "Convert text to speech",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Union ways": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download audio": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message type": {
      "main": [
        [
          {
            "node": "Get sticker",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Writing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Writing2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Recording audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download image": {
      "main": [
        [
          {
            "node": "Is analyze?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate output json": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Message type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is image?": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Union ways",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download welcome sticker": {
      "main": [
        [
          {
            "node": "Send welcome sticker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select image": {
      "main": [
        [
          {
            "node": "Generate output json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is analyze?": {
      "main": [
        [
          {
            "node": "Analyze an image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b2dc5d50-a481-4ea0-88ed-864e69487cdc",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "0qGmlYdFmCKntvy3",
  "tags": []
}

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

How this works

This workflow powers an intelligent Telegram bot that responds to user messages with context-aware replies, drawing on stored knowledge to deliver accurate and relevant information without manual intervention. It's ideal for developers or businesses seeking to automate customer support, Q&A services, or interactive chats on Telegram, saving hours of response time while maintaining a natural conversational flow. The core step involves processing incoming messages through Ollama's chat model, which generates embeddings and queries a Qdrant vector store to retrieve pertinent data before crafting the final output.

Use this workflow when building event-driven bots that need to handle queries against a knowledge base, such as FAQs or product info, integrated with Telegram for real-time interaction. Avoid it for simple bots without AI needs, like basic notifications, or when scaling to millions of users without custom optimisation. Common variations include swapping Qdrant for another vector store or adding Postgres memory for persistent conversation history across sessions.

About this workflow

Telegram bot. Uses telegramTrigger, embeddingsOllama, lmChatOllama, toolVectorStore. Event-driven trigger; 26 nodes.

Source: https://github.com/jtmckay/existential/blob/main/graveyard/n8n/workflows/workflow_01_telegram_bot.json — 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

Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.

Gmail Tool, Google Calendar Tool, Gmail +24
AI & RAG

Gourmet Bistro Customer Service. Uses telegramTrigger, lmChatOllama, embeddingsOllama, memoryPostgresChat. Event-driven trigger; 32 nodes.

Telegram Trigger, Ollama Chat, Ollama Embeddings +10
AI & RAG

HR & IT Helpdesk Chatbot with Audio Transcription. Uses stickyNote, manualTrigger, httpRequest, extractFromFile. Event-driven trigger; 27 nodes.

HTTP Request, Vector Store Pgvector, OpenAI Embeddings +9
AI & RAG

HR & IT Helpdesk Chatbot with Audio Transcription. Uses stickyNote, manualTrigger, httpRequest, extractFromFile. Event-driven trigger; 27 nodes.

HTTP Request, Vector Store Pgvector, OpenAI Embeddings +9
AI & RAG

An intelligent chatbot that assists employees by answering common HR or IT questions, supporting both text and audio messages. This unique feature ensures employees can conveniently ask questions via

HTTP Request, Vector Store Pgvector, OpenAI Embeddings +9