Back to blog

How to connect your AI agent to Telegram (complete setup guide)

Step-by-step guide to connecting your OpenClaw personal AI agent to Telegram. Create a bot, get your token, and start chatting with your private AI in minutes.

K-Claw Team·December 01, 2025·3 min read

Why Telegram?

Telegram is the recommended channel for your OpenClaw agent for several reasons. It has a mature, well-documented Bot API, works on every platform (iOS, Android, desktop, web), supports message formatting, file sharing, and inline keyboards, and bot creation is completely free with no approval process.

Most importantly: Telegram messages between you and your bot are private. OpenClaw communicates with Telegram's servers to deliver your messages, but the AI model only processes what you send — your conversation history stays on your VPS.

Step 1: create your Telegram bot

Open Telegram and search for @BotFather — Telegram's official bot creation service. Start a conversation and send:

/newbot

BotFather will ask for:

  1. A name for your bot — this is the display name people see (e.g., "My AI Assistant")
  2. A username — must end in "bot" (e.g., "myassistant_bot")

After both are confirmed, BotFather sends you a bot token — a long string like 1234567890:ABCdefGHIjklMNOpqrSTUvwxYZ. Copy and save this immediately.

Step 2: configure bot privacy

By default, bots in group chats receive all messages. For a personal agent, you want to keep it focused. In BotFather:

/setprivacy

Select your bot and choose Enable. This means your bot only receives messages directed at it (starting with / or mentioning it). For personal use in direct messages, this setting doesn't affect anything, but it's good practice.

Also consider setting a description and profile photo:

/setdescription
/setuserpic

Step 3: get your Telegram user ID

OpenClaw needs to know which Telegram account is authorized to interact with your agent — you don't want just anyone messaging your personal AI. To get your user ID, open a chat with @userinfobot and send /start. It replies with your numeric user ID.

Write this down. During k-claw installation, you'll provide this ID as the authorized user.

Step 4: install OpenClaw via k-claw

With your bot token and user ID ready, run the k-claw installer on your VPS:

curl -fsSL https://claw.krokanti.com/install | bash

When the installer asks for your messaging channel, select Telegram. It will prompt for:

  • Your bot token (from BotFather)
  • Your Telegram user ID (from @userinfobot)
  • Your AI API key
  • The AI model you want to use

The installer configures OpenClaw, sets up the systemd service, and starts your agent automatically.

Step 5: start chatting

Open Telegram and search for your bot by username. Send /start to initialize it, then ask anything:

What's the capital of Australia?
Summarize the key points of the last email I shared with you.
Remind me tomorrow at 9am to review the project proposal.

Your agent replies directly in the chat, with the AI model processing each message via API and the conversation history stored privately on your VPS.

Useful bot commands

OpenClaw comes with several built-in commands you can set up in BotFather for a better user experience:

/setcommands

Then paste:

start - Initialize the agent
help - Show available commands
memory - Show what the agent remembers
clear - Clear conversation context
status - Check agent status

Troubleshooting

Common issues after setup:

  • Bot doesn't respond: Check the systemd service — systemctl status kclaw-agent. Look for errors in the logs with journalctl -u kclaw-agent -n 50.
  • Invalid token error: Ensure you copied the full token from BotFather without extra spaces.
  • Unauthorized user error: Verify your Telegram user ID matches what you provided during installation. IDs are numeric only.
  • API rate limits: If you're sending many messages quickly, the AI API may rate-limit requests. OpenClaw handles retries automatically, but response times may slow temporarily.

The k-claw dashboard shows your installation status and logs in real time, making it easy to diagnose any issues without needing to SSH into your server.

Your AI agent, always in your pocket.

Connect OpenClaw to Telegram in minutes. Ask questions, delegate tasks, and get briefings — all from your phone.

Connect to Telegram