This workflow corresponds to n8n.io template #9339 — we link there as the canonical source.
This workflow follows the Agent → Gmail Tool 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": "OSYF5WIhk948USGT",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Telegram Email Assistant Talking Voice",
"tags": [],
"nodes": [
{
"id": "89b37dd5-3bcd-4d78-b85a-62b710e12201",
"name": "Window Buffer Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
400,
384
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "e102bd92-ce01-4bef-b55e-8b75ed74eea9",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-320,
160
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"chatIds": "123456789"
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "ecc735f2-01bf-473f-b105-d35ddaa7bc2e",
"name": "Set 'Text'",
"type": "n8n-nodes-base.set",
"position": [
128,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fe7ecc99-e1e8-4a5e-bdd6-6fce9757b234",
"name": "text",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b3582073-7def-49d0-99bc-f63c0dc0066f",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-144,
144
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice.file_id }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8c844924-b2ed-48b0-935c-c66a8fd0c778",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Image",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e5513059-0748-4e97-b26b-d0fd332b0cfc",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.document.mime_type }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "2f7a02d1-638a-4909-a86e-897bbf9d7986",
"name": "Download File",
"type": "n8n-nodes-base.telegram",
"position": [
0,
0
],
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "a465b1c0-9c36-415b-a0b5-297fd420bfde",
"name": "Transcribe",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
192,
0
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.6
},
{
"id": "d6d9f05a-cac7-4e1f-8f88-767b822e2628",
"name": "Draft Email",
"type": "n8n-nodes-base.gmailTool",
"position": [
640,
384
],
"parameters": {
"message": "={{ $fromAI(\"emailBody\") }}",
"options": {},
"subject": "={{ $fromAI(\"subject\") }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "b916980b-9741-428e-95d1-71a285985b4f",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
288,
336
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "c3a9ca6e-279a-4fb6-ab87-9c40da6633b2",
"name": "Transcribe1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
704,
144
],
"parameters": {
"input": "={{ $json.output }}",
"voice": "onyx",
"options": {
"response_format": "mp3"
},
"resource": "audio"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.6
},
{
"id": "f0c266bd-9717-4ff3-99bb-79b091430605",
"name": "Send Email",
"type": "n8n-nodes-base.gmailTool",
"position": [
768,
384
],
"parameters": {
"sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
"message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
"options": {},
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "6a50fff9-8ee5-40de-807d-94fe2f0004f7",
"name": "Get Emails",
"type": "n8n-nodes-base.gmailTool",
"position": [
512,
368
],
"parameters": {
"limit": 3,
"filters": {
"labelIds": [
"INBOX"
],
"receivedAfter": "={{ $fromAI('received_after', 'Retrieve emails received after the current date, given a period specified by user if any. This is calculated dynamically based on the current date.', 'string') }}",
"receivedBefore": "={{ $fromAI('received_before', 'Retrieve emails received before the current time today. This is calculated dynamically based on the current date.', 'string') }}"
},
"operation": "getAll",
"descriptionType": "manual",
"toolDescription": "Get many messages in Gmail"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "e39713a4-df9b-486e-9200-92ef2154a1a0",
"name": "Email Manager",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
368,
144
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "=# Overview\nYou are the ultimate personal assistant. Your job is to send the user's query to the correct tool. You should never be writing emails, or creating even summaries, you just need to call the correct tool.\n\n## Tools\n- Get Emails: Use this tool to search and get full text of received email. If you are asked for, extract the text of the emails.\n- Draft Emails: Use this tool to draft email response or new emails\n- Send Emails: Use this tool to send emails\n\n## Rules\n- Some actions require you to look up contact information first. For the following actions, you must get contact information and send that to the agent who needs it:\n - sending emails\n - drafting emails\n\n\n## Final Reminders\nHere is the current date/time: {{ $now }}"
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "9d6cb3d8-2574-4bba-bbde-33ce42d671df",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
-240
],
"parameters": {
"color": 3,
"width": 576,
"height": 1072,
"content": "## For more tutorials visit our [Youtube](https://www.youtube.com/@AIBIZElevate77)\n\n\n---\n### 1. Setup\n**1. Create a Telegram bot (via @BotFather)**\n - Copy your Bot Token into the Telegram node.\n**2. Add credentials in n8n:**\n - Telegram (Bot Token)\n - OpenAI (API key, for chat/voice transcription)\n - Gmail (OAuth2, for draft/send email)\n**3. Assign these credentials to respective nodes:**\n - Telegram Trigger\n - OpenAI Chat Model\n - Draft Email, Send Email, Get Emails\n**4. Activate the workflow** and start a chat with your Telegram bot.\n\n\n---\n### 2. How to customize this workflow to your needs\n**1. Modify node logic:**\n - Change how voice/text/image is routed.\n - Add new response conditions in the Switch node.\n**2. Add integrations:**\n - Extend with more actions\u2014Notion, Slack, or custom tools.\n**3. Email management:**\n - Adjust Draft/Send Email nodes for your messaging style (subject, formatting).\n**4. Transcription/AI settings:**\n - Update Model/Transcribe nodes to use your preferred OpenAI settings or prompt styles.\n**5. Buffer/Memory:**\n - Use the Window Buffer/Memory nodes to manage session state or history.\n\n\n---\n### 3. Node Breakdown & Flow\n**Telegram Trigger:** Listens for all messages.\n**Switch (Rules):** Routes messages (voice, text, image) to the right logic.\n**Voice:**\n- Download File > Transcribe > Generate Audio > Respond (audio reply)\n**Text:**\n- Set Text > AI Chat Model > Respond (chat reply)\n**Image/File:**\n- Download/Tag as needed in future versions\n**Email:**\n- Draft Email > Send Email > Get Emails (inbox queries)\n**Session State:**\n- Memory & Window Buffer nodes manage chat/session data for smarter automation.\n\n\n---\n## Need Help or Want to Customize?\nFor further automation or integration, feel free to [book an appointment](https://aibizelevate.com/) or [LinkedIn](https://www.linkedin.com/in/barbora-svobodova-461b92285/)\n\n"
},
"typeVersion": 1
},
{
"id": "f55f2900-881b-4dbb-9e77-4d20fe7dd48e",
"name": "Audio Response",
"type": "n8n-nodes-base.telegram",
"position": [
896,
144
],
"parameters": {
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"operation": "sendAudio",
"binaryData": true,
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "9ea42cef-3a39-4660-838a-c73547a76a13",
"name": "Text Response",
"type": "n8n-nodes-base.telegram",
"position": [
672,
-32
],
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c5d9b70b-332a-4c58-9ff9-661f8fdfb0f1",
"connections": {
"Switch": {
"main": [
[
{
"node": "Download File",
"type": "main",
"index": 0
}
],
[
{
"node": "Set 'Text'",
"type": "main",
"index": 0
}
],
[]
]
},
"Get Emails": {
"ai_tool": [
[
{
"node": "Email Manager",
"type": "ai_tool",
"index": 0
}
]
]
},
"Send Email": {
"ai_tool": [
[
{
"node": "Email Manager",
"type": "ai_tool",
"index": 0
}
]
]
},
"Set 'Text'": {
"main": [
[
{
"node": "Email Manager",
"type": "main",
"index": 0
}
]
]
},
"Transcribe": {
"main": [
[
{
"node": "Email Manager",
"type": "main",
"index": 0
}
]
]
},
"Draft Email": {
"ai_tool": [
[
{
"node": "Email Manager",
"type": "ai_tool",
"index": 0
}
]
]
},
"Transcribe1": {
"main": [
[
{
"node": "Audio Response",
"type": "main",
"index": 0
}
]
]
},
"Download File": {
"main": [
[
{
"node": "Transcribe",
"type": "main",
"index": 0
}
]
]
},
"Email Manager": {
"main": [
[
{
"node": "Text Response",
"type": "main",
"index": 0
},
{
"node": "Transcribe1",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Email Manager",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Window Buffer Memory": {
"ai_memory": [
[
{
"node": "Email Manager",
"type": "ai_memory",
"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.
gmailOAuth2openAiApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is perfect for professionals and teams who want to manage email communications hands-free directly from Telegram. Simply send a voice message to your bot and seamlessly check your recent emails, draft or send a reply, and discuss email threads—all powered by…
Source: https://n8n.io/workflows/9339/ — 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.
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