DEV Community

Altiora
Altiora

Posted on

How to Build a Telegram AI Assistant with n8n (No Code Required)

If you've ever wanted a personal AI assistant that lives in Telegram — one that can interpret your messages, execute tasks, and check back before acting — you can build it with n8n in under an hour.

I'll walk you through the architecture, the key nodes, and the gotchas.

Why Telegram + n8n?

Telegram has one of the best bot APIs available. Combined with n8n's visual workflow builder, you get:

  • Instant message handling via webhooks
  • AI reasoning with OpenAI/Claude nodes
  • Task execution (CRM updates, emails, calendar events)
  • Human-in-the-loop approval before critical actions

The Architecture

Telegram Message → n8n Webhook → AI Agent Node → Decision Router
                                                    ↓
                                          [Execute Task] or [Ask for Approval]
                                                    ↓
                                          Telegram Response ← Result
Enter fullscreen mode Exit fullscreen mode

Step 1: Set Up Your Telegram Bot

  1. Open Telegram, search for @BotFather
  2. Send /newbot and follow the prompts
  3. Copy your bot token

Step 2: Create the n8n Workflow

Trigger: Telegram Trigger Node

  • Select "On Message" event
  • Paste your bot token
  • This fires every time someone sends a message to your bot

Node 2: AI Agent (OpenAI/Claude)

Configure the AI node with a system prompt:

You are a personal assistant. When the user asks you to do something:
1. Identify the task type (email, calendar, CRM, reminder)
2. Extract the key parameters
3. Return a JSON with: {action, params, needs_approval}
Enter fullscreen mode Exit fullscreen mode

Node 3: Switch/Router

Based on needs_approval:

  • true → Send confirmation message back to Telegram
  • false → Execute immediately

Node 4: Action Nodes

Connect your actual integrations:

  • Gmail node for sending emails
  • Google Calendar for scheduling
  • HTTP Request for CRM/API calls

Node 5: Response

Send the result back to Telegram with a summary.

Adding Persistent Memory

The secret sauce that makes your bot actually useful over time:

  1. Add a Postgres/Supabase node before the AI agent
  2. Query recent conversations (last 10 messages)
  3. Inject them as context into the AI system prompt
  4. After each interaction, store the message + response

This gives your bot conversation continuity across sessions.

Pro Tips

  • Rate limit your webhook — Telegram can send bursts
  • Add error handling — wrap action nodes in try/catch
  • Log everything — use a Google Sheet as a simple audit trail
  • Start simple — get message→response working before adding actions

The Result

You'll have a Telegram bot that:

  • Understands natural language commands
  • Executes real tasks across your tools
  • Remembers context from previous conversations
  • Asks for approval on critical actions

Want Pre-Built n8n Workflows?

I've packaged three production-ready n8n workflows (GitHub triage, daily standup, client pipeline) into a single bundle:

👉 AI Automation Starter Pack — 3 n8n Workflows for €59

Each workflow comes with setup instructions, environment variables, and is ready to import into your n8n instance.


What's the first thing you'd automate with a Telegram AI assistant? Drop a comment below.

Top comments (0)