AI Agents Workshop with Yuval KeshtcherLearn about upcoming cohorts →
AI Makers Lab

Build Your First OpenClaw Agent with Claude Code

0/5
All tutorials
General
Advanced
20 minutes
5 milestones

Build Your First OpenClaw Agent with Claude Code

What you'll build

A personal AI agent running on your Mac, connected to Telegram, responding to messages with Claude's intelligence.

Milestone 0 of 50% complete

The Problem

Everyone's posting screenshots of their AI agent running on Telegram. It summarizes articles, drafts emails, answers questions about their calendar — while they're eating lunch. You've seen the tweets. You want in. But every setup guide assumes you know Docker, YAML config files, and have three hours to spare.

What You're Building

A self-hosted OpenClaw agent on your Mac that connects to Telegram and responds to your messages using Claude. Not a chatbot wrapper — an agent you own and control. You need Claude Code and 20 minutes.

Verify before starting: Open your terminal and type claude — if it opens, you're good. Make sure your Anthropic API key is stored in ~/.zshrc as ANTHROPIC_API_KEY.


Milestone 1: Install OpenClaw

Your Mac doesn't know what OpenClaw is yet. Let's fix that.

Prompt
Install OpenClaw on my Mac. Run the official install script from openclaw.ai and verify it installed correctly by checking the version. If I need Node.js 22+, install that first.

What Claude Code does: It downloads and runs the OpenClaw installer, which sets up the openclaw CLI on your system. OpenClaw runs locally on your machine — it's not a cloud service. Your data, your hardware, your agent. Claude Code also checks for Node.js 22+ and installs it if needed.

Try it: Run openclaw --version in your terminal. You should see a version number. That's your agent framework, installed and ready.


Milestone 2: Configure the AI Brain

OpenClaw is installed but it has no brain. It doesn't know which AI model to use or where to find your API key.

Prompt
Create an OpenClaw configuration file at ~/.openclaw/openclaw.json. Set it up to use Claude Sonnet as the primary model and Haiku as the fallback. My Anthropic API key is stored in my environment as ANTHROPIC_API_KEY — reference it from the env variable, don't hardcode it. Set the gateway to local mode on the default port.

What Claude Code does: It creates the JSON5 config file that tells OpenClaw which AI to use. The config file is the control center — model selection, fallback chains, port settings, everything lives here. By referencing your env variable instead of pasting the key, you keep credentials secure.

Try it: Run cat ~/.openclaw/openclaw.json — you should see your model config with anthropic/claude-sonnet-4-6 as primary and anthropic/claude-haiku-4-5 as fallback.


Milestone 3: Create Your Telegram Bot

You have the agent framework. You have the AI model. Now you need a way to talk to it. Telegram bots are free and take 60 seconds to create.

Walk me through creating a Telegram bot step by step. I need to: 1) Open BotFather on Telegram, 2) Create a new bot, 3) Get the bot token. Then update my ~/.openclaw/openclaw.json to add a Telegram channel configuration using that bot token. Set DM policy to "open" so I can message it directly.

What Claude Code does: It gives you the exact steps for BotFather (Telegram's bot creation tool), then updates your config file with the Telegram channel block. BotFather gives you one token — that token is the only bridge between Telegram and your agent. Claude Code adds the channel config with dmPolicy: "open" so your bot accepts direct messages from you.

Try it: Search for your bot's name in Telegram. It should appear. It won't respond yet — the gateway isn't running.


Milestone 4: Launch the Gateway

Everything is configured. The agent has a brain (Claude), a channel (Telegram), and a home (your Mac). Time to flip the switch.

Start the OpenClaw gateway and verify it's connected to Telegram. Run it as a background daemon so it keeps running after I close the terminal. Then check the gateway status to confirm the Telegram channel is active.

What Claude Code does: It starts the OpenClaw gateway daemon, which is the central router — it listens for messages from all connected channels (right now just Telegram), sends them to Claude, and routes responses back. Running it as a daemon means it survives terminal closes.

Try it: Run openclaw gateway status. You should see the gateway running on port 18789 with Telegram showing as "connected."


Milestone 5: Talk to Your Agent

The gateway is running. Telegram is connected. Claude is ready. Time to test.

Prompt
Show me how to check the OpenClaw logs in real time. I'm going to open Telegram and send my bot a message — I want to watch the full request/response cycle in the logs as it happens.

What Claude Code does: It opens the live log stream so you can see every message flowing through: Telegram → OpenClaw Gateway → Claude API → OpenClaw → Telegram. You own every step. When you send a message in Telegram, the logs show exactly what the agent received, what it sent to Claude, and what came back.

Try it: Open Telegram, find your bot, and type "Hello! Who are you?" While watching the logs, you'll see the message arrive, get processed, and the response sent back. Within seconds, your bot responds — through YOUR agent, on YOUR machine.


What You Built

Remember wanting to be one of those people with a personal AI agent on Telegram? You just became one. In 20 minutes, you:

  • Installed a self-hosted AI agent framework
  • Configured Claude as the brain with a fallback model
  • Created a Telegram bot and connected it to your agent
  • Launched a gateway daemon that routes messages 24/7
  • Sent your first message and got an intelligent response

This isn't a toy. This is the same architecture that powers AI workflows at companies. The difference is it's running on your Mac and you control everything.

Take It Further

  • Give it a name and personality — change the system prompt so it responds as your custom assistant (that's Lesson 2)
  • Add more channels — Discord, WhatsApp, Slack. Same agent, multiple interfaces
  • Install skills from ClawHub — add abilities like web search, file management, or calendar integration with one command

Ready to build your first AI agent?

Live Zoom workshop + 1 month WhatsApp follow-up with Yuval Keshtcher (Hebrew)

Learn about the Workshop