This workflow corresponds to n8n.io template #12003 — 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 →
{
"id": "mZWNq71A16sU28CC",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AI-Powered Telegram Bot for Voice & Text Responses with OpenAI and Gemini",
"tags": [],
"nodes": [
{
"id": "6e3dba9d-ebc0-4528-b37b-a4450f298047",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-192,
-192
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5d069b59-2fc9-4824-a145-670bb64caa84",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
816,
112
],
"parameters": {
"options": {},
"promptType": "guardrails"
},
"typeVersion": 3
},
{
"id": "8680b003-7ea7-4968-b236-fd0894a46171",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
816,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "7a6bc9a2-6753-4ec3-ae06-ef64b0cc3b22",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
912,
320
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "d2f18e66-8215-4ddd-a5e8-3967dd7084e2",
"name": "Send a text message",
"type": "n8n-nodes-base.telegram",
"position": [
1360,
112
],
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "88f1e0e3-0cdc-492b-9ab9-3bbb7c81be6e",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
16,
-192
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fb9abdd0-d33f-471c-8b30-715f3edd7345",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.voice.mime_type }}",
"rightValue": "audio/ogg"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "45296bdf-9d7c-4f9a-a4d0-8f10fa6fbb86",
"name": "Transcribe a recording",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
576,
-208
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "audio",
"inputType": "binary"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "371ad5fb-6e85-455d-b972-1aae2b132f9d",
"name": "Get a file",
"type": "n8n-nodes-base.telegram",
"position": [
272,
-208
],
"parameters": {
"fileId": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "3080a68e-9188-415a-9918-3f2e9cfb7647",
"name": "AI Agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
816,
-208
],
"parameters": {
"text": "=here's the transcription: {{ $json.content.parts[0].text }}",
"options": {
"systemMessage": "You are an ai agent for my telegram bot. you will be given a transcription of a voice message from telegram and you have to answer that user query."
},
"promptType": "define"
},
"typeVersion": 3
},
{
"id": "daeeaae8-d007-4394-9f8b-f20c34ebe806",
"name": "Generate audio",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1152,
-208
],
"parameters": {
"input": "={{ $json.output }}",
"options": {},
"resource": "audio"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "84dd802d-cb60-4541-bdd5-ccbdaa6fb922",
"name": "Send an audio file",
"type": "n8n-nodes-base.telegram",
"position": [
1360,
-208
],
"parameters": {
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"operation": "sendAudio",
"binaryData": true,
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "ae63a2da-4b34-4872-99bd-e67f565bc3ef",
"name": "Guardrails",
"type": "@n8n/n8n-nodes-langchain.guardrails",
"position": [
272,
128
],
"parameters": {
"text": "={{ $json.message.text }}",
"guardrails": {}
},
"typeVersion": 1
},
{
"id": "e1a0ffe8-5957-407a-8ecc-20b88bbdb5c5",
"name": "Send a text message1",
"type": "n8n-nodes-base.telegram",
"position": [
576,
144
],
"parameters": {
"text": "=Sorry! your text violates our policies",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5bb892ad-c2f3-49b6-ac87-25e2bb5a4add",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
272,
320
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "b3344122-bd3d-4d9d-bc3c-61bd6c9f9e36",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-32
],
"parameters": {
"width": 400,
"height": 400,
"content": "## How to setup\n\n1. Create a telegram bot using bot father and the bot father will give you an API key\n2. Copy the API key and set it up in a telegram node inside n8n\n3. Get a free gemini api from https://aistudio.google.com/\n4. set up the gemini API in the Transcribe recording node\n5. Get an OpenAI API key from https://platform.openai.com/docs/overview and make sure to top up your credits\n6. Copy the API key from OpenAI platform and set it up in any OpenAI Chat Model and it will be configured for all other nodes automatically by n8n\n\nThat's it! now you can activate the workflow and test it by sending a simple message to your telegram bot"
},
"typeVersion": 1
},
{
"id": "817c6cb3-9f9f-4b69-9d1a-53bef9f895dc",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-352
],
"parameters": {
"color": 6,
"width": 1296,
"height": 304,
"content": "## Handle Voice Message\n\nTips:\n* You can edit the system prompt in the AI Agent node according to your needs"
},
"typeVersion": 1
},
{
"id": "a3e4881d-0cad-4504-bd48-cbeb10723269",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-16
],
"parameters": {
"color": 6,
"width": 1296,
"height": 464,
"content": "## Handle Text Message\n\nTips:\n* You can edit the system prompt in the AI Agent node according to your needs"
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "565436df-fc6c-4916-b864-000ad7b512f0",
"connections": {
"If": {
"main": [
[
{
"node": "Get a file",
"type": "main",
"index": 0
}
],
[
{
"node": "Guardrails",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Generate audio",
"type": "main",
"index": 0
}
]
]
},
"Get a file": {
"main": [
[
{
"node": "Transcribe a recording",
"type": "main",
"index": 0
}
]
]
},
"Guardrails": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Send a text message1",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
},
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"Generate audio": {
"main": [
[
{
"node": "Send an audio file",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
},
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Guardrails",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Transcribe a recording": {
"main": [
[
{
"node": "AI Agent1",
"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.
googlePalmApiopenAiApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
How it works: This Telegram automation works with voice and text messages given to the Telegram bot, and it returns the response in voice form if the input is in voice form. If the input is in text form, it will return a response in text form.
Source: https://n8n.io/workflows/12003/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
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
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.
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
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
This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.