Skip to content

Blog

Turn a Raspberry Pi into your personal Telegram AI bot

Step-by-step: build a self-hosted Telegram bot that's actually an AI assistant with memory, running on your own Pi via deputyOS.

4 min read deputyOS team

New to deputyOS? The fastest path is to run it on your laptop first — no Pi, no commitment. This post focuses on the Telegram channel specifically, which works the same whether your deputyOS runs on a laptop VM, a Pi, or a cloud VPS.

Setting up a Telegram bot used to mean spinning up a Node project, fighting node-gyp, hosting it on a VPS, and writing your own state machine. deputyOS collapses all of that into a wizard.

This post is short because the actual setup is short.

The path

1. Flash and boot deputyOS

See Run a personal AI assistant on a Raspberry Pi 5 in 10 minutes for the full walkthrough. Pick the OpenClaw profile.

2. Make a bot in Telegram

Open Telegram, search @BotFather. Send:

/newbot

It asks for a name, then a username (must end in bot). Copy the token it gives you. It looks like 123456789:AAH....

3. Paste the token in the wizard

In http://deputyos.local/wizard, you’ll hit the “Channels” step. Toggle Telegram on, paste the bot token, click Verify. The wizard calls getMe against the Bot API to confirm the token is valid. Green check; move on.

4. Say hi

Open your bot’s chat in Telegram. Send any message. The agent replies within 1–3 seconds depending on your model provider’s latency.

That’s it.

What you actually built

A bot that’s qualitatively different from “a webhook glued to ChatGPT”:

  • Persistent memory. Every conversation builds context the agent uses next time. The memory lives in /var/lib/openclaw/ on the Pi. You own it. You can grep it. You can back it up.
  • Multi-channel awareness. If you wire up Slack later, the agent recognises it’s the same you. Skills you give it (calendar, files, web search) work across all channels uniformly.
  • Cost guardrails. Per-day and per-month spend caps with auto-pause. Telegram won’t be able to accidentally drain your credits.
  • Magika file safety. When friends send your bot files, Magika sniffs the actual content type. Spoofed extensions don’t fool it.
  • Hooks. Pre-message, post-message, cost-alert, update-applied. Drop a script in /etc/deputyos/hooks.d/ and it runs on every event. Logging, routing, slack notifications — all clean.

What about WhatsApp, Discord, Signal?

All work the same way. The wizard has a channel tile for each. Some (WhatsApp Cloud) need a one-time Meta Business verification; the wizard documents it. Discord needs a bot token + slash-command registration; same flow.

The add-a-channel doc covers extending OpenClaw to new channels — it’s profile-config, not Rust code.

Hosting math

A Raspberry Pi 5 8 GB costs about $80 once. Power: ~5 W idle, ~10 W under load. Annual electricity cost: ~$5–10 in most US markets. SD card or NVMe: $15–60 depending on speed. SD-card lifespan: a year or two if cheap, 5+ years if Pi-grade.

A comparable cloud VPS: $4–6/month, so $50–70/year, indefinitely.

The Pi pays for itself in 14–18 months and then runs forever. (We do have a DigitalOcean walkthrough for users who’d rather pay for the cloud.)

Privacy posture

By default, your Telegram bot’s traffic goes Telegram-servers → your-Pi → your-model-provider → back. The conversation passes through Telegram (their terms apply) and your chosen model provider (their terms apply). It does not pass through any deputyOS-operated server because we don’t operate one.

If you want stricter — no model provider involved at all — use the air-gapped tier and accept that the bot replies are powered by LFM2 locally. Slower, but private end-to-end.

Common follow-ups

”Can it reach the internet to search for things?”

Yes, when you enable channels or skills that need it. The default OpenClaw build assumes outbound HTTPS works. The air-gapped tier blocks egress at nftables — incompatible with a web-search skill (obviously).

”What if I want it to read my files?”

Mount the folder via the drive-mounting subsystem. The agent sees it under /mnt/deputyos/<id>/ with the mode you chose (read-only or read-write).

”What if it goes haywire?”

deputyctl down stops it. deputyctl logs --follow streams the journal. deputyctl factory-reset wipes the data partition without touching the OS.

”Can I write my own skill?”

Yes. OpenClaw skills are TypeScript files dropped into /etc/openclaw/skills/. There’s no rebuild. See the OpenClaw docs for the skill API.

Why this matters

The cheapest way to “have a Telegram bot” today is to glue ChatGPT to a webhook. That works. But it accumulates: provider whim, conversation history you can’t access, monthly bills, no offline mode, no portability if you want to migrate to a different model.

A self-hosted bot inverts every one of those properties. Five minutes’ more setup; orders-of-magnitude more leverage long-term.

The picker is the start. Once it’s running, your Pi is doing real, useful work for you, on hardware you can hold.

Related posts

Search

Search index isn't built yet. Run npm run build to generate it (Pagefind writes to dist/pagefind/).