Skip to content

n8n + Telegram: Build a Personal Assistant Bot That Actually Does Stuff

This page may contain affiliate links.

Most "personal assistant" bots are toys. You ask them the weather, they answer, and you never open the chat again. The interesting version is different: a bot that runs on your own hardware, talks to your own data, and quietly does the boring admin you keep putting off. n8n is perfect for this because it's a visual workflow tool you can self-host, and Telegram is the ideal front end — fast, free, and it already lives on your phone. Here's how to build one properly.

Why n8n plus Telegram is the right combination

Telegram bots are free to create and have a genuinely good API. You message a bot, Telegram fires a webhook, and your workflow runs. No app store, no mobile development, no monthly SaaS fee.

n8n gives you the glue. It can call HTTP APIs, read and write to a Postgres or SQLite database, run JavaScript in a Code node, and schedule things with a Cron trigger. Crucially, you can self-host it, which means your notes, your calendar and your API keys never leave your own box. If you're running it on a small VPS, expect to pay roughly the price of a couple of coffees a month — check current pricing with your host, as it varies.

If you'd rather not self-host, n8n's cloud plans are also an option, but the self-hosted route is what makes the privacy argument work.

Step one: create the bot and wire up the webhook

Open Telegram, find @BotFather, and send /newbot. Follow the prompts, pick a name and a username ending in bot. BotFather hands you a token that looks like 123456789:AAH.... Keep that secret — anyone with it controls your bot.

In n8n, add a Telegram Trigger node and paste the token into a new credential. Choose "On Message" as the update type. n8n will register the webhook for you, but it needs a publicly reachable URL. If you're running n8n locally, put it behind a tunnel or a reverse proxy with a real domain and HTTPS. Telegram will not talk to a bare IP on port 5678.

Send your bot a message. You should see the payload appear in the n8n execution log. That's the whole handshake done.

Step two: give it a brain (routing by command)

A useful assistant needs to know what you're asking. The simplest robust approach is a Switch node that reads the message text and routes on prefix. Add a Code node before it to normalise the input:

const text = ($json.message.text || '').trim();
const [cmd, ...rest] = text.split(' ');
return [{ json: { cmd: cmd.toLowerCase(), body: rest.join(' '), chatId: $json.message.chat.id } }];

Then a Switch node with rules like {{ $json.cmd }} equals /note, /remind, /ask, /brief. Each output goes to its own branch. This pattern scales — adding a new command is one more Switch rule and one more branch.

Always reply using a Telegram node with the Send Message operation and the chat ID from the trigger. Without a reply, the bot feels broken even when it's working.

Step three: three commands worth building first

/note — capture anything. Take {{ $json.body }} and insert it into a Postgres or SQLite table with columns for content, chat ID and timestamp. Use an n8n Postgres node with an INSERT query. Later, a /search command runs SELECT ... WHERE content ILIKE '%' || $1 || '%'. Suddenly your Telegram chat is a searchable second brain.

/remind — scheduled nudges. Write the reminder to a table with a due_at timestamp. Add a separate workflow on a Cron trigger running every five minutes that selects rows where due_at <= NOW() and sent = false, sends the Telegram message, and marks them sent. This is far more reliable than trying to keep timers in memory.

/ask — talk to your own data. Pipe the question to an LLM node with a system prompt like: "You are a concise assistant. Answer in under 80 words. If the question is about the user's notes, use only the provided context." Feed in the last few matching rows from your notes table as context. Keep replies short — long messages in Telegram are a pain to read on a phone.

Step four: the daily briefing

This is the feature that makes people actually keep using the bot. A second workflow on a Cron trigger fires at 07:30. It gathers: today's calendar events from a Google Calendar node, any reminders due in the next 24 hours from your database, and the top three unread items from an RSS or news API. Format it into a single message and send it to your chat ID.

Build the message with a Code node returning a template literal, then send it once. One message, every morning, containing only what you need. No app to open, no dashboard to check.

If you want a shortcut on the plumbing — the Switch routing, the reminder scheduler, the briefing template — n8n Starter Workflows is a pack of importable templates I put together, from £9. It's the done-for-you version of exactly this article, so you can skip the fiddly bits and start customising.

Practical gotchas worth knowing

Lock down who can use it. Add an IF node straight after the trigger checking {{ $json.message.chat.id }} against your own chat ID. Without this, anyone who guesses your bot's username can write to your database.

Handle errors visibly. Set the workflow's error workflow to something that sends you a Telegram message. Silent failures are the number one reason people abandon a self-hosted bot.

Don't over-engineer the first version. Two commands that work beat ten that half-work. Ship /note and /remind, use them for a fortnight, then add what you actually miss.

Keep secrets out of nodes. Use n8n credentials rather than hardcoding API keys into Code nodes, especially if you ever export the workflow to share it.

If you're running n8n on a mini PC or a Raspberry Pi, a small UPS is genuinely worth having — power cuts corrupt databases, and a basic one costs less than a decent takeaway. You can browse options here: mini UPS for Raspberry Pi.

The takeaway

A personal assistant bot isn't about impressive AI demos. It's about shaving ten small frictions out of your day: capturing a thought before you lose it, being reminded at the right moment, and getting one clean briefing instead of checking four apps. n8n and Telegram give you all the pieces for free, running on hardware you control. Start with the trigger, add one command, and let it grow from there. Within a week you'll wonder how you managed without it.

Written by

Richard Tucker

View all posts →