AutomationFlowsAI & RAG › Voice & Text Telegram Assistant with Gpt-4.1-mini and Conversation Memory

Voice & Text Telegram Assistant with Gpt-4.1-mini and Conversation Memory

ByBalakrishnan C @balakrishnandevops on n8n.io

Who It’s For: This workflow is designed for developers, founders, community managers, and automation enthusiasts who want to bring a personal AI assistant directly into their Telegram chat. It lets users interact naturally—either through text or voice messages—and get instant,…

Event trigger★★★★☆ complexityAI-powered18 nodesTelegram TriggerAgentOpenAI ChatTelegramMemory Buffer WindowOpenAI
AI & RAG Trigger: Event Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:
Voice & Text Telegram Assistant with Gpt-4.1-mini and Conversation Memory — n8n workflow card showing Telegram Trigger, Agent, OpenAI Chat integration

This workflow corresponds to n8n.io template #9981 — 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": "AVzZ0VuRrjztizVp",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Personal AI Assistant on Telegram",
  "tags": [
    {
      "id": "1yZiArijt4TA2xCQ",
      "name": "assistant",
      "createdAt": "2025-10-13T20:19:10.089Z",
      "updatedAt": "2025-10-13T20:19:10.089Z"
    },
    {
      "id": "dq2RsbUNZZAcjqKZ",
      "name": "telegram",
      "createdAt": "2025-10-13T20:19:10.091Z",
      "updatedAt": "2025-10-13T20:19:10.091Z"
    }
  ],
  "nodes": [
    {
      "id": "a3b8de01-dfe2-4973-affa-f602c07a0b65",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -64,
        80
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4be5becc-3487-498d-b796-b40a91b9329c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1392,
        48
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=You are a personal assistant that helps user fulfill their requests.\n\nWhen you are asked to perform a task on the current date, please use the current time and date :  {{ $now }}\n\n## OUtput\n\nYou should output the result and don't include any thing unnecessary. Just  make sure that you politely answer user question and ask if any other information is required."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "67b709b2-68ce-49c1-ad70-d13e67bcecce",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1360,
        352
      ],
      "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": "1815073f-3372-4021-84bf-9c117f01a111",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ed66987c-b2d8-4e33-bad2-e6476c594990",
              "name": "message.text",
              "type": "string",
              "value": "={{ $json.message.text }}"
            },
            {
              "id": "93500e9e-a398-49f4-b4d3-151bcf68d44c",
              "name": "sessionId",
              "type": "number",
              "value": "={{ $json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0cfb4cc4-5b87-4b1e-bf09-50e875605640",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1888,
        48
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cd8ef26f-5f45-46ec-a152-dc14fcbdf398",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1552,
        352
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 7
      },
      "typeVersion": 1.3
    },
    {
      "id": "7d32da5c-90c7-4c7f-942a-cfdb44d471f6",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        256,
        80
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "feabf872-0ae2-4749-a240-4997aa07c59f",
                    "operator": {
                      "type": "boolean",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "voice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "aca5831b-bc5d-4b59-aae2-0e450eb2221f",
                    "operator": {
                      "type": "boolean",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.2
    },
    {
      "id": "951546cb-0d17-44f0-80c8-cedcb64269c3",
      "name": "Get a file",
      "type": "n8n-nodes-base.telegram",
      "position": [
        512,
        320
      ],
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "42f0d043-b796-425e-a4ff-5c3a2136d02c",
      "name": "Transcribe a recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        752,
        320
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f02a02f5-917a-424e-a24a-ae3b1b40fa09",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7f5016ec-e3f5-491e-8684-cf240b0fc116",
              "name": "message.text",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "b763d61b-3378-4bec-bc45-3578071e54e3",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1103380a-2e93-492f-81ab-0f90851605ae",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        -128,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 236,
        "height": 252,
        "content": "\ud83d\udca1 It activates this workflow and triggers/initiates the Telegram message!"
      },
      "typeVersion": 1
    },
    {
      "id": "d34e0902-7667-44c8-a59b-8b97a2830b23",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        176,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 252,
        "height": 300,
        "content": "\ud83d\udca1 It split the input from the user. If the user input is text. Then it goes directly to the test field. Else it will be converted into Text Format."
      },
      "typeVersion": 1
    },
    {
      "id": "f39d3b38-725e-4621-9fa1-c3b9051e7aea",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        368,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 244,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83d\udca1 This node helps your agent to fetch the voice note file"
      },
      "typeVersion": 1
    },
    {
      "id": "01cf3628-2ef2-4307-b46f-0b9412120992",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        672,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 292,
        "height": 276,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83d\udca1 Transcriber helps to convert the voice into words/text format to analyze the word from the user. "
      },
      "typeVersion": 1
    },
    {
      "id": "8b9899c0-f007-4a2b-b0f8-4ebd7e866e46",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        992,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 724,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83d\udca1 These nodes get the input text message from Telegram. Then it throws to the AI Agent to give the response back with the help of the OpenAI Chat Model!"
      },
      "typeVersion": 1
    },
    {
      "id": "5726d2ac-c4cb-4e74-b8db-23ec20f16979",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        1296,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 396,
        "height": 300,
        "content": "\ud83d\udca1 Your AI agent can:\n1. **Receive** messages from the Telegram chat\n2. **Respond** with the OpenAI Chat Model and provide helpful answers.\n\n\n\n\n\n\n\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "99437331-d7d5-4d42-94bd-75105baa5562",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        1296,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 436,
        "height": 324,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83d\udca1 This is the **GPT 4.1 mini** chat model. Here we need to connect with our **API key** to utilize this AI model.\n\n\ud83d\udca1 And this is a simple memory to help your agent remember the last few messages to stay on topic."
      },
      "typeVersion": 1
    },
    {
      "id": "bed59b48-c359-4200-b4a6-eadab0e28c7b",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "2025 Balakrishnan",
      "creator": "Balakrishnan",
      "position": [
        1776,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 316,
        "height": 316,
        "content": "\ud83d\udca1 This will send back the response to the user in Telegram. \n\n\ud83d\udca1 Here we need to connect with our **Telegram API key** to make a connection."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dd57966f-ee98-4844-8b12-f72a782dc0a3",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "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

Who It’s For: This workflow is designed for developers, founders, community managers, and automation enthusiasts who want to bring a personal AI assistant directly into their Telegram chat. It lets users interact naturally—either through text or voice messages—and get instant,…

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