Build an AI Assistant on Telegram (Voice + Text) with n8n
· By AI Compare
A Telegram bot that understands voice and text, remembers context and uses your tools, built in n8n.
What you will build
A personal AI assistant you talk to in Telegram. Send it a text or a voice note; it transcribes the voice, understands the request, uses tools (calendar, email, contacts, web search) and replies in text or audio. It remembers the recent conversation, so follow-up questions work.
This follows the structure of n8n's community template "Turn Telegram into an AI assistant with OpenAI voice, memory and tools".
What you need
- An n8n instance with a public HTTPS URL (n8n Cloud, or self-hosted with a domain). Telegram must be able to reach your webhook.
- A Telegram account.
- An OpenAI API key (chat, transcription and optional text-to-speech). You can swap in other model providers for chat.
- Optional: Google credentials for Calendar and Gmail tools.
Step 1: Create the Telegram bot
- In Telegram, open @BotFather and send
/newbot. - Choose a display name and a username ending in
bot(5–32 characters). - Copy the token BotFather gives you.
- In n8n, create a Telegram credential and paste the token as the Access Token.
Step 2: The workflow structure
| # | Node | Purpose |
|---|---|---|
| 1 | Telegram Trigger (updates: message) | Receives every message sent to the bot |
| 2 | IF: sender check | Only allow your own Telegram user ID, so strangers cannot use your assistant (and your API budget) |
| 3 | Switch: text or voice | Routes by whether message.voice exists |
| 4 | Telegram: Get File (voice branch) | Downloads the voice note as binary data |
| 5 | OpenAI: Transcribe a recording | Turns the audio into text |
| 6 | Edit Fields (Set) | Puts text from either branch into one field, for example prompt |
| 7 | AI Agent | Reasons about the request and decides which tools to call |
| 8 | Chat model + memory (sub-nodes) | OpenAI Chat Model and Simple Memory keyed by the Telegram chat ID |
| 9 | Tools (sub-nodes) | Google Calendar, Gmail, web search, calculator |
| 10 | Telegram: Send Message | Replies in the same chat |
Step 3: Configure the AI Agent
- Prompt: map the unified
promptfield from step 6. - System message: describe the assistant's role, your timezone, and rules, for example: "You are my personal assistant. Today is {{ $now }}. Confirm before sending emails."
- Memory: use Simple Memory with the session key
{{ $('Telegram Trigger').item.json.message.chat.id }}so each chat has its own history. - Tools: add each tool as a sub-node and give it a clear description, such as "Create calendar events. Input: title, start time, end time."
Step 4: Reply with voice (optional)
Add an OpenAI Generate audio (text-to-speech) node after the agent and send the result with Telegram Send Audio or Send Voice. Keep a text reply as the default; voice replies cost more and are slower.
Security and cost tips
- Always check the sender's user ID. A public bot without this check can be used by anyone who finds it.
- Ask the agent to confirm before actions that send email or delete things.
- Voice transcription and long conversations cost tokens. Limit memory to the last 10–20 messages.
n8n vs Zapier and Make for this use case
Telegram triggers exist in all three tools, but n8n's AI Agent with tools and memory in one workflow makes it the most practical place to build a real assistant. In Zapier or Make you would need several steps per tool and more operations per message. See AI agents in Zapier vs Make vs n8n.

