think&test
Home / Lesson 05
Think & Test · Lesson 05

Build a small OpenClaw Telegram bot

Learn the path from a message in Telegram to a self-hosted agent response. Start with a private, text-only bot and a harmless task before considering file access or automation.

What you’re learning

OpenClaw is a self-hosted gateway that connects chat apps such as Telegram to an AI agent. It is not itself the language model: it needs a model provider, and the agent may also have tools. Those tools and channel permissions determine what it can do.

Work through it

  1. Read the current setup guide. Follow the official OpenClaw getting-started guide for your operating system. Do not paste setup commands from random tutorials; the project and its requirements can change.
  2. Choose a model provider. Start with a local Ollama model if it meets your needs. If you choose a hosted API, check its billing and data terms first. Keep API keys in the local configuration or secret store; never put them in a website, screenshot, or public repository.
  3. Create a Telegram bot. Use Telegram’s official BotFather flow to create a bot and store its token privately. Configure OpenClaw’s Telegram channel using its current docs. Limit access to your own Telegram account while testing.
  4. Test with harmless requests. Ask it to summarize a public paragraph or explain a command. Confirm only your account can reach the bot. Review any tool permissions before giving it access to files or shell commands.

Example command / prompt

# Start with text-only questions and a private allowlist.
# Use the current OpenClaw docs for installation and Telegram configuration.
Keep this in mind. An agent with file or shell tools can affect your computer. Keep it away from personal folders, credentials, and important files while learning. Do not make a bot public or give it broad filesystem access. A Telegram bot token and model API key are secrets.
Try thisSend the same harmless question to the bot and to Ollama directly. Record the added value of Telegram, then inspect exactly what the agent can access before expanding permissions.

Official references