It’s Monday morning. Your phone has 47 Telegram messages from the weekend — group chats, project updates, a few direct messages you actually need to act on, and a lot of noise.
It’s 8:55am. Your first meeting is at 9:00.
What if your agent had already read everything, filtered the important parts, and left you a one-paragraph summary before you woke up?
That’s not science fiction. That’s a heartbeat-scheduled OpenClaw agent. Let’s build it.
This tutorial assumes you’ve already installed OpenClaw. If not: How to Install OpenClaw on Ubuntu, macOS, and Windows.
What We’re Building
By the end of this tutorial, you’ll have:
- An OpenClaw agent connected to Telegram
- A heartbeat schedule that runs every morning at 8:45am
- The agent reading your recent messages and leaving a digest in memory
- An understanding of where everything is stored on your machine
- The ability to switch LLMs with a single config change
Time required: about 15 minutes if you’re following along.
Step 1: Create Your Agent
If you ran openclaw init during setup, you already have an agent. Check:
ls ~/.openclaw/agents/
If it’s empty or you want a fresh agent for this tutorial:
openclaw agent create --name morningbot
This creates the directory structure:
~/.openclaw/agents/morningbot/
├── config.yaml ← agent configuration
├── memory/ ← where it remembers things
├── prompts/ ← system prompt files
└── logs/ ← what it did and when
Step 2: Open the Config
nano ~/.openclaw/agents/morningbot/config.yaml
A fresh agent config looks something like this:
name: morningbot
llm:
provider: claude
model: claude-sonnet-4-6
apiKey: sk-ant-your-key-here
messaging: []
heartbeat:
enabled: false
schedule: ""
memory:
enabled: true
directory: ./memory
Let’s fill this in.
Step 3: Connect Telegram
Get a Bot Token
- Open Telegram and search for @BotFather
- Send
/newbot - Give your bot a name (e.g.,
Morning Briefing Bot) - Give it a username ending in
bot(e.g.,morningbriefingbot) - BotFather will send you a token that looks like:
7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy that token.
Add Telegram to Your Config
messaging:
- platform: telegram
botToken: "7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
allowedUsers:
- your_telegram_username
The allowedUsers field is important — it prevents anyone who finds your bot from interacting with it.
Start a Conversation
Before OpenClaw can respond to you, Telegram requires that you initiate the conversation first (bots can’t send the first message). Open Telegram, find your bot by its username, and send /start.
Step 4: Set Up the Heartbeat Schedule
The heartbeat is what makes OpenClaw autonomous — it runs your agent on a schedule, even when you’re not actively talking to it.
Update your config:
heartbeat:
enabled: true
schedule: "45 8 * * *" # every day at 8:45am
task: |
Review my Telegram messages from the last 12 hours.
Identify anything that needs my attention today.
Write a brief morning digest to memory with key action items.
Keep it under 150 words.
The schedule uses standard cron syntax: minute hour day month weekday.
A few useful schedules:
| Schedule | Cron |
|---|---|
| Every day at 8:45am | 45 8 * * * |
| Weekdays at 9am | 0 9 * * 1-5 |
| Every 2 hours | 0 */2 * * * |
| Every Sunday at 6pm | 0 18 * * 0 |
Step 5: Write a System Prompt
The system prompt tells your agent who it is and how it should behave. Create the file:
nano ~/.openclaw/agents/morningbot/prompts/system.md
Here’s a good starting point:
You are a personal assistant agent for [your name].
Your primary job is to help manage information flow — summarizing messages,
tracking action items, and providing concise briefings.
Communication style:
- Be brief. Bullet points over paragraphs.
- Flag urgent items clearly.
- Never pad responses with filler phrases.
Memory: You have access to previous conversations and notes in your memory
directory. Use them to maintain context across sessions.
Current priorities: [add your actual priorities here]
The more specific you make this, the better your agent performs. Generic system prompts produce generic agents.
Step 6: Start Your Agent
openclaw start --agent morningbot
The TUI will launch. You’ll see your agent’s status, recent activity, and incoming messages.
Send a message to your bot in Telegram: Hello, what can you do?
You should get a response within a few seconds describing its capabilities based on your system prompt.
Where Memory Lives
Open a new terminal window and look at this directory while your agent is running:
ls -la ~/.openclaw/agents/morningbot/memory/
After a few conversations, you’ll see files like:
2026-03-12-morning-digest.md
2026-03-12-conversation-notes.md
preferences.md
Open one:
cat ~/.openclaw/agents/morningbot/memory/2026-03-12-morning-digest.md
It’s just Markdown. Plain text. Human-readable. You can edit it, back it up, search it with grep, or move it to a new machine.
This is the entire memory system. There’s no database. There’s no API call to retrieve your history. It’s files.
Switching LLMs in One Line
This is one of OpenClaw’s most underrated features. Your agent isn’t locked to one provider.
To switch from Claude to GPT-4o:
llm:
provider: openai
model: gpt-4o
apiKey: sk-your-openai-key
Restart the agent, and it’s now using GPT-4o as its brain. Your memory files stay exactly the same. Your system prompt stays the same. Your Telegram integration stays the same.
To run a test with DeepSeek R1:
llm:
provider: deepseek
model: deepseek-r1
apiKey: your-deepseek-key
You can maintain multiple agent configs and run different agents with different LLMs simultaneously.
Two Weeks Later
Here’s what happens after your agent has been running for a couple of weeks:
It knows you don’t respond to Telegram messages before 9am — because you told it that in your system prompt and it’s referenced the pattern in your conversations.
It knows your current active projects — because you mentioned them in passing and it wrote them to preferences.md.
It knows that messages from a specific group chat are low-priority — because you told it once and it remembered.
The agent doesn’t just answer questions. It accumulates context. And because that context lives in plain Markdown files on your machine, it’s yours forever.
What’s Next
Now that you have a working agent, the interesting stuff starts:
Make agents talk to each other: OpenClaw Multi-Agent Setup: Make Your Agents Talk to Each Other
Connect more platforms: OpenClaw Integrations: Connect WhatsApp, Telegram, Slack and More
Related Reading.
OpenClaw Integrations: Connect WhatsApp, Telegram, Slack and More
Step-by-step guide to connecting OpenClaw to Telegram, WhatsApp, Slack, and Discord — including bot token setup, voice mode config, multi-platform routing, and privacy notes.
What Are Agent Skills? AI Tools Explained Simply
Agent skills are the actions an AI can take beyond just talking. Learn what skills are, how they differ from prompts, and why they make AI actually useful in real workflows.
OpenClaw Multi-Agent Setup: Make Your Agents Talk to Each Other
Learn how to build OpenClaw multi-agent pipelines using ACP — connect a research agent, writer agent, and publisher agent so they work together autonomously overnight.