AutomationFlowsAI & RAG › Telegram AI Bot for Text and Voice Messages

Telegram AI Bot for Text and Voice Messages

Original n8n title: Conversational Telegram Bot with Gpt-5/gpt-4o for Text and Voice Messages

ByRoninimous @roninimous on n8n.io

This n8n workflow leverages a Telegram Message Trigger to activate an intelligent AI Agent capable of processing both text and voice messages. When a user sends a message in text or in voice format, the workflow captures and transcribes it (if necessary), then passes it to the…

Event trigger★★★★☆ complexityAI-powered11 nodesTelegram TriggerOpenAI ChatMemory Buffer WindowTelegramOpenAIAgent
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → OpenAI Chat 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": "RV4zArpzN5InxYND",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Conversational Telegram Bot with GPT-4o for Text and Voice Messages",
  "tags": [
    {
      "id": "hlEHEpOdSg5lhIqi",
      "name": "Template",
      "createdAt": "2025-06-05T15:35:52.689Z",
      "updatedAt": "2025-06-05T15:35:52.689Z"
    }
  ],
  "nodes": [
    {
      "id": "a33e3f45-f16e-4107-937e-0ce1d230060f",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -660,
        -180
      ],
      "parameters": {
        "updates": [
          "message",
          "*"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e17f452c-4f9a-48f8-91a2-526260159676",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        520,
        420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b33ec46-8772-4bfb-a448-fea5a673bbaa",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        740,
        460
      ],
      "parameters": {
        "sessionKey": "={{ $json.sessionId }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "8cdd7ba8-c998-4ea7-b861-8dcaf12febfe",
      "name": "Get Voice",
      "type": "n8n-nodes-base.telegram",
      "position": [
        80,
        0
      ],
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7fa34d0e-5215-44e5-b1d3-1e8abb5771ae",
      "name": "Text Or Voice",
      "type": "n8n-nodes-base.switch",
      "position": [
        -240,
        -180
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0a236099-525e-4748-a57d-8b8e2c63c48b",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "24b7e8b8-6fce-4ddc-94b6-30b852891995",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{  $json.message.voice.file_id }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "b90a586b-5d90-4f76-8e4e-bd44095f9aac",
      "name": "Transcribe The Voice",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        280,
        0
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "587adf8a-2e69-4078-a603-84f0322207cb",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        720,
        80
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=# Overview\nYou are a personal assistant that helps user to fulfill their request.\n\nWhen you are asked to perform a task on the current date, please use the current time and date: {{$now}}\n\n## Output\nYou should output the result and don't include any link. Just mentioned where you added it to."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "2455c7cb-f341-4891-9096-dc62116298c0",
      "name": "Typing Action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -240,
        -360
      ],
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8c2b6195-6101-4652-848c-505d13a3c1d2",
      "name": "Send Response To Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1340,
        80
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{$('Telegram Trigger').first().json.message.chat.id}}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c8fd047d-8575-484e-939a-46064b81d035",
      "name": "Send Context To AI Agent",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "590b803f-833c-4854-bde7-5241d25b2b32",
              "name": "message.text",
              "type": "string",
              "value": "={{ $json.message.text }}"
            },
            {
              "id": "303e0b5d-3d37-48fc-bbd3-ce62dbe7ef78",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f7e90526-08a5-4a59-956f-d39e6ff472f0",
      "name": "Send Transcribe Context To AI Agent",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2bb71aef-0ca1-4c26-95e1-c0c83bc82068",
              "name": "message.text",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "692a2bae-35da-41d3-be8d-32c0f5dfbbef",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "timezone": "Australia/Sydney",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "3a29c25b-e7bd-41a7-91ee-4438fa9c1c1a",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Response To Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice": {
      "main": [
        [
          {
            "node": "Transcribe The Voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Text Or Voice": {
      "main": [
        [
          {
            "node": "Send Context To AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Typing Action": {
      "main": [
        []
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Text Or Voice",
            "type": "main",
            "index": 0
          },
          {
            "node": "Typing Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe The Voice": {
      "main": [
        [
          {
            "node": "Send Transcribe Context To AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Context To AI Agent": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Transcribe Context To AI Agent": {
      "main": [
        [
          {
            "node": "AI Agent",
            "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 n8n workflow leverages a Telegram Message Trigger to activate an intelligent AI Agent capable of processing both text and voice messages. When a user sends a message in text or in voice format, the workflow captures and transcribes it (if necessary), then passes it to the…

Source: https://n8n.io/workflows/4696/ — 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

BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.

Agent, Telegram Trigger, Telegram +10
AI & RAG

Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon

OpenAI, HTTP Request, OpenAI Chat +7
AI & RAG

Jarvis is a powerful multi-agent productivity assistant built in n8n. It works directly from Telegram and can understand both text messages and voice notes.

Telegram Trigger, Telegram, OpenAI +10
AI & RAG

Unlock the Power of Language with Personalized AI Learning! MOTION TUTOR is a revolutionary AI-powered language learning platform that adapts to your progress and guides you from basic vocabulary to c

Agent, Airtable Tool, OpenAI Chat +6
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