DEV Community

Cover image for I built a universal Telegram AI assistant with n8n
Павло Вересюк
Павло Вересюк

Posted on

I built a universal Telegram AI assistant with n8n

I've been managing a Telegram channel for a while and kept spending time answering the same questions manually. So I built one n8n workflow that now does it for me automatically.

The cool thing is it works in any Telegram chat. You just change the system prompt and it adapts completely.

What it does

When someone sends a message it figures out what to do on its own. If it's a photo — it downloads it and uses Groq Vision to actually see what's in the image. If the question needs current info — it searches the web via Tavily and answers with real data. For regular messages — it loads conversation history from Google Sheets and replies with full context like it remembers everything.

The flow

Telegram Trigger → Parse Message → Should Skip → IF photo → Vision → Reply. Or needs search → Tavily → Reply. Otherwise → Load History → Groq LLM → Save → Reply.

Why it's flexible

Same workflow, different prompt — completely different assistant. I use it in a tech channel, a shop, and a community chat. Each one feels like a separate bot but it's all one workflow.

Stack

n8n self-hosted, Groq API, Tavily search, Google Sheets for memory, Telegram Bot API.

Took a few hours to build. Now it just runs.

I share more workflows like this in my Telegram channel n8nAutomationHub if you want to follow along.

Top comments (0)