Phase 1 / Ep 06: Your First Message — The Complete Conversation Flow from CLI to Telegram
🎯 Learning Objective: Successfully send your first message and understand the complete message flow path.
1. Direct Conversation via CLI
The simplest way—talk to the Agent directly in the terminal:
# Start interactive chat
openclaw chat
# Or single message mode
openclaw chat "What's the weather like today?"
In interactive mode, you will see:
🦀 OpenClaw Chat (personal)
Type /help for commands, /quit to exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
You: Hello, introduce yourself
Agent: Hello! I am your OpenClaw personal Agent.
I run on your local machine and can help you:
- Search the internet
- Manage files
- Execute Shell commands
- Set reminders
How can I help you today?
2. Telegram Integration
Step 1: Create a Bot with BotFather
- Search for
@BotFatherin Telegram - Send
/newbot - Follow the prompts to fill in the Bot name and username
- Obtain the Bot Token:
7123456789:AAH...
Step 2: Add Telegram Channel
openclaw channels add telegram --token "7123456789:AAH..."
Step 3: Pairing
Send any message to your Bot, and the Agent will return a Pairing Code. Confirm it in the CLI:
openclaw channels pair <code>
Pairing complete! Now you can talk to the Agent directly in Telegram.
3. End-to-End Message Flow
sequenceDiagram
actor User as 🧑 User
participant TG as 📱 Telegram Bot
participant GW as 🦀 Gateway
participant Auth as 🔐 Auth Engine
participant Perm as 🛡️ Permission Check
participant Agent as 🤖 Agent
participant Boot as 📋 Bootstrap
participant Mem as 🧠 Memory
participant LLM as 🧪 Claude API
User->>TG: "Help me check tomorrow's weather in Beijing"
TG->>GW: Webhook Push
GW->>Auth: Verify user identity
Auth->>Perm: Check permission level
Perm->>Agent: Route to personal Agent
Note over Agent: Initialize context
Agent->>Boot: Load SOUL.md, USER.md...
Agent->>Mem: Retrieve relevant memory
Agent->>LLM: Assemble Prompt + Tool definitions
LLM->>Agent: Return tool_use: web_search
Agent->>Agent: Execute web_search("Beijing tomorrow weather")
Agent->>LLM: Submit tool execution results
LLM->>Agent: Return final response
Agent->>GW: Pass response
GW->>TG: Push reply
TG->>User: "Tomorrow in Beijing: Sunny, 28°C / 17°C\nAir Quality: Good"4. CLI vs Telegram Comparison
| Operation | CLI | Telegram |
|---|---|---|
| Send message | openclaw chat "xxx" |
Direct message |
| Clear session | openclaw sessions clear |
/clear |
| View help | openclaw --help |
/help |
| View status | openclaw status |
/status |
| Exit | /quit or Ctrl+C |
N/A (Just close the chat) |
5. Congratulations!
Your Agent is now alive. It runs on your machine, possesses the identity you gave it (SOUL.md), knows who you are (USER.md), and is learning to remember your conversations.
Starting from the next chapter, we will dive deep into the CLI command system—mastering every OpenClaw command to become a true Agent administrator.
Next Episode Preview: Ep 07, entering Phase 2! We start with Gateway lifecycle management: start, stop, restart, and daemon mode. Each command will synchronously demonstrate its equivalent operation in both CLI and Telegram.