This workflow corresponds to n8n.io template #16023 — we link there as the canonical source.
This workflow follows the Agent → Google Sheets 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": "91cf951e9bf0b6ff",
"name": "Build a Telegram AI agent with voice, tools and memory using OpenAI",
"tags": [
{
"name": "telegram"
},
{
"name": "ai-agent"
},
{
"name": "voice-assistant"
},
{
"name": "whisper"
},
{
"name": "chatbot"
},
{
"name": "conversation-memory"
},
{
"name": "openai"
},
{
"name": "ai"
}
],
"nodes": [
{
"id": "c7df7ac4-0d37-459b-a9a3-a92885e8c8f2",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-256
],
"parameters": {
"width": 480,
"height": 640,
"content": "## Build a Telegram AI agent with voice, tools and memory using OpenAI\n\n## How it works\n\n1. Detects messages from Telegram using a trigger.\n2. Determines if a message is a voice message or text.\n3. Downloads and transcribes voice messages using OpenAI.\n4. Processes the message content using a Telegram AI assistant.\n5. Sends replies back to Telegram and logs interactions to Google Sheets.\n\n## Setup steps\n\n- [ ] Configure Telegram credentials in the Telegram Trigger node.\n- [ ] Set up OpenAI API credentials for voice transcription.\n- [ ] Configure Google Sheets API for logging conversations.\n\n## Customization\n\nAdjust AI agent's tools and memory settings for different AI assistant capabilities."
},
"typeVersion": 1
},
{
"id": "65ab9708-ce60-4224-8225-b8a376378b3a",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-128
],
"parameters": {
"color": 7,
"width": 432,
"height": 304,
"content": "## Telegram message intake\n\nDetects and branches on incoming Telegram messages."
},
"typeVersion": 1
},
{
"id": "7918c821-8ce9-482a-b9f1-892200ff49a4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
-256
],
"parameters": {
"color": 7,
"width": 416,
"height": 304,
"content": "## Handle voice messages\n\nDownloads and transcribes Telegram voice messages."
},
"typeVersion": 1
},
{
"id": "b179087f-a602-4a82-9f28-1838dae7b8db",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
-112
],
"parameters": {
"color": 7,
"width": 592,
"height": 496,
"content": "## AI processing and response\n\nProcesses messages with AI tools and sends outcomes."
},
"typeVersion": 1
},
{
"id": "33d3d2fa-4c86-4464-b216-d47656cb1ccc",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1472,
-128
],
"parameters": {
"color": 7,
"width": 240,
"height": 304,
"content": "## Conversation logging\n\nLogs the AI interaction details to Google Sheets."
},
"typeVersion": 1
},
{
"id": "b0fd82fa-d2b7-434d-8135-c6bc33c0a614",
"name": "When Message Received",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-40,
0
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "b9bae9d0-a854-430f-b4c3-0fb43250168f",
"name": "If Voice Message",
"type": "n8n-nodes-base.if",
"position": [
200,
0
],
"parameters": {
"conditions": {
"options": {
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ !!$json.message.voice }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2
},
{
"id": "22daf731-9336-4526-9387-8b660a1ed89d",
"name": "Download Telegram Voice",
"type": "n8n-nodes-base.telegram",
"position": [
448,
-112
],
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file"
},
"typeVersion": 1.2
},
{
"id": "382679e9-fa78-4413-8cf8-0e95960f530d",
"name": "Transcribe Voice with OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
672,
-112
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"typeVersion": 1.4
},
{
"id": "9cdcf3a2-2e29-43a1-8a35-57d5672c66e2",
"name": "AI Conversation Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1008,
0
],
"parameters": {
"text": "={{ $json.text || $json.message.text }}",
"options": {
"systemMessage": "You are a concise, friendly assistant on Telegram. Reply in the user's language. Use the Wikipedia tool to look up facts you are unsure about, and the Calculator tool for any arithmetic. Keep replies under 1500 characters."
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "f2c09212-d7b8-4427-85db-8b8657d0a601",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
896,
240
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {
"temperature": 0.4
}
},
"typeVersion": 1.2
},
{
"id": "bf6b2bf3-3680-4438-b2e1-eb8f4a61cea4",
"name": "Manage Conversation Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1040,
240
],
"parameters": {
"sessionKey": "={{ $('When Message Received').item.json.message.chat.id }}",
"sessionIdType": "customKey",
"contextWindowLength": 12
},
"typeVersion": 1.3
},
{
"id": "8b48d33d-2a0c-4b21-a41c-f017bc1d69b5",
"name": "Fetch Information from Wikipedia",
"type": "@n8n/n8n-nodes-langchain.toolWikipedia",
"position": [
1168,
240
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6f232d05-a632-4b8b-b909-80cfb9c6f477",
"name": "Perform Calculations",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1312,
240
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c74ca54b-e97d-4533-9ffc-218871c29a81",
"name": "Send Response via Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1280,
0
],
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('When Message Received').item.json.message.chat.id }}",
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "dcda13a9-b31f-4fc5-a97b-b50cf1c9f725",
"name": "Append Log to Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
1520,
0
],
"parameters": {
"sheet": {
"__rl": true,
"mode": "list",
"value": "Chat Log"
},
"columns": {
"value": {},
"mappingMode": "autoMapInputData"
},
"options": {},
"operation": "append",
"documentId": {
"__rl": true,
"mode": "url",
"value": "https://docs.google.com/spreadsheets/d/REPLACE_ID/edit"
}
},
"typeVersion": 4.5
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"connections": {
"If Voice Message": {
"main": [
[
{
"node": "Download Telegram Voice",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Conversation Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Conversation Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Perform Calculations": {
"ai_tool": [
[
{
"node": "AI Conversation Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"AI Conversation Agent": {
"main": [
[
{
"node": "Send Response via Telegram",
"type": "main",
"index": 0
}
]
]
},
"When Message Received": {
"main": [
[
{
"node": "If Voice Message",
"type": "main",
"index": 0
}
]
]
},
"Download Telegram Voice": {
"main": [
[
{
"node": "Transcribe Voice with OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Manage Conversation Memory": {
"ai_memory": [
[
{
"node": "AI Conversation Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Send Response via Telegram": {
"main": [
[
{
"node": "Append Log to Sheets",
"type": "main",
"index": 0
}
]
]
},
"Transcribe Voice with OpenAI": {
"main": [
[
{
"node": "AI Conversation Agent",
"type": "main",
"index": 0
}
]
]
},
"Fetch Information from Wikipedia": {
"ai_tool": [
[
{
"node": "AI Conversation Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow listens for incoming Telegram messages, sends each message to an OpenAI chat model via an AI agent with per-chat memory, and replies in the same Telegram conversation with a concise, language-matched response. Triggers when a new Telegram message is received by…
Source: https://n8n.io/workflows/16023/ — 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.
BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
Personal Assistant. Uses memoryBufferWindow, agent, agentTool, httpRequestTool. Event-driven trigger; 77 nodes.
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.