Demo Thực Tế - OpenClaw in Action
Mục tiêu: Tập hợp các demo hoạt động thực tế của OpenClaw với lệnh chạy được.
Demo 1: Personal Assistant - Daily Briefing
Setup
# 1. Cấu hình Telegram bot
openclaw config set channels.telegram.botToken "${TELEGRAM_BOT_TOKEN}"
# 2. Thêm số điện thoại vào allowlist
openclaw allowlist add telegram 123456789
# 3. Khởi động Gateway
openclaw gateway --port 18789Usage
Trong Telegram:
8:00 AM: "Good morning! Give me my daily briefing"
OpenClaw: ☀️ **Daily Briefing**
━━━━━━━━━━━━
📧 **Emails cần xử lý**:
• Meeting invitation from John (10:00 AM)
• Invoice from Vendor ABC
📅 **Lịch hôm nay**:
• 10:00 - Team Standup
• 14:00 - Client Meeting
• 16:00 - Code Review
📋 **Tasks ưu tiên**:
• Complete PR #123
• Update documentation
Would you like me to draft replies or set reminders?Cron Job tự động
openclaw cron add \
--name "morning-briefing" \
--schedule "0 8 * * *" \
--timezone "Asia/Ho_Chi_Minh" \
--message "Send daily briefing with emails, calendar, and priority tasks" \
--channel telegram \
--to "123456789"Demo 2: Code Assistant - Review & Debug
Setup
# Bật system tools để AI đọc/ghi file
# Cách 1: Dùng profile (khuyến nghị)
openclaw config set tools.profile coding
# Cách 2: Hoặc allow specific tools
openclaw config set tools.allow '["exec", "fs_read", "fs_write", "fetch"]'Usage
Example 1: Review PR
Discord: "Review this PR: https://github.com/myorg/project/pull/456"
OpenClaw: 🔍 Code Review: PR #456
Summary: Add user authentication middleware
Changes: • src/middleware/auth.ts - New file, 45 lines • src/routes/user.ts - Added auth check
Issues: ⚠️ Line 23: Missing null check for req.headers ⚠️ Line 34: Hardcoded secret key - use env var
Suggestions: ✅ Add test coverage for edge cases ✅ Consider rate limiting
Want me to suggest fixes or write tests?
Example 2: Debug Error
Telegram: "Debug this error: [paste stack trace] Error: Cannot read property 'id' of undefined at UserController.getProfile (src/controllers/user.ts:23:15)"
OpenClaw: 🐛 Debug Analysis
Root Cause: user object is undefined at line 23
Probable causes:
- Database query returned null
- Missing authentication check
- Race condition in async call
Fix suggestion:
// src/controllers/user.ts:23
const user = await User.findById(id);
if (!user) {
throw new NotFoundError("User not found");
}
return user.id; // Now safeShould I create a PR with this fix?
Demo 3: File Processing - Tự động hóa
📁 Chuẩn bị File - Hướng dẫn chi tiết
1. Vị trí đặt file
OpenClaw chỉ đọc/ghi file trong một số thư mục an toàn (sandbox). Thực tế, các thư mục bạn tự tạo như ~/openclaw-data/ vẫn OK vì nó nằm bên trong Home directory.
| Vị trí | Path đầy đủ | Mục đích |
|---|---|---|
| Home directory | /home/<user>/ hoặc C:\Users\<user>\ (ví dụ: ~/openclaw-data/) | File cá nhân, báo cáo |
| Workspace | ~/workspace/ hoặc thư mục agent đang chạy (ví dụ: ~/workspace/openclaw-data/) | Code, project files |
| System | /tmp/, /var/log/ (cần quyền root) | Log files, temp data |
| OpenClaw data | ~/.openclaw/sessions/, ~/.openclaw/logs/ | Session logs |
⚠️ Quan trọng: OpenClaw không đọc được file ngoài các thư mục trên (security sandbox).
2. Cấu trúc thư mục chuẩn
Tạo cấu trúc thư mục cho OpenClaw:
# Tạo thư mục chính
mkdir -p ~/openclaw-data/{reports,invoices,meetings,exports,uploads}
# Phân quyền đúng (Linux/Mac)
chmod 755 ~/openclaw-data
chmod 644 ~/openclaw-data/reports/*
# Cấu trúc đề xuất
~/openclaw-data/
├── reports/ # Báo cáo, CSV, Excel
├── invoices/ # Hóa đơn, PDF
├── meetings/ # Meeting notes, transcript
├── exports/ # File xuất ra từ OpenClaw
└── uploads/ # File tạm upload3. Định dạng file được hỗ trợ
| Định dạng | Extension | Notes |
|---|---|---|
| Text | .txt, .md, .log | Tốt nhất cho phân tích |
| CSV | .csv | Có header, UTF-8 encoding |
| JSON | .json | Pretty-printed hoặc minified |
| Code | .js, .py, .ts, etc. | Syntax highlighting trong response |
| Markdown | .md | Meeting notes, tài liệu |
.pdf | Cần tools.pdf.enabled | |
| Excel | .xlsx, .xls | Cần chuyển CSV hoặc dùng tool đặc biệt |
4. Chuẩn bị file CSV cho phân tích
File CSV chuẩn (~/openclaw-data/reports/q4-sales.csv):
Date,Product,Region,Amount,Quantity,Customer
2024-10-01,Enterprise License,APAC,15000,3,TechCorp
2024-10-02,Professional Plan,EMEA,5000,10,StartupXYZ
2024-10-03,Enterprise License,North America,25000,5,BigCorp IncYêu cầu:
- Header row bắt buộc
- Encoding: UTF-8 (không BOM)
- Delimiter: comma (
,) hoặc semicolon (;) - Không có space ở đầu tên cột
- Ngày:
YYYY-MM-DDformat
Kiểm tra file:
# Kiểm tra encoding
file ~/openclaw-data/reports/q4-sales.csv
# Xem 5 dòng đầu
head -n 5 ~/openclaw-data/reports/q4-sales.csv
# Kiểm tra dòng trống
grep -c "^$" ~/openclaw-data/reports/q4-sales.csv5. Chuẩn bị Meeting Notes
File Markdown (~/openclaw-data/meetings/2024-01-15-sprint.md):
# Sprint Planning Meeting
**Date**: 2024-01-15
**Time**: 10:00 - 10:45
**Attendees**: John, Jane, Bob, Alice, Mike
## Agenda
1. Sprint 2 Retro
2. Q1 Sprint 3 Planning
3. Blockers discussion
## Completed
- [x] Sprint 2 retro done
- [x] Velocity: 34 points
## Blockers
- API dependency from Platform team (ETA: Wed)
- AWS credits need approval
## Action Items
| Owner | Task | Due |
| ----- | ----------------- | ------ |
| John | Fix auth bug #234 | Jan 17 |
| Jane | Update API docs | Jan 18 |6. Permissions và Security
# Kiểm tra quyền file hiện tại
ls -la ~/openclaw-data/reports/
# Set quyền đọc cho owner
chmod 600 ~/openclaw-data/invoices/sensitive.pdf
# Set quyền đọc cho group (nếu cần)
chmod 640 ~/openclaw-data/reports/public.csv
# Kiểm tra OpenClaw có đọc được không
sudo -u openclaw cat ~/openclaw-data/reports/test.csvSetup
# Bật file tools
# Cách 1: Dùng profile
openclaw config set tools.profile full
# Cách 2: Hoặc allow specific tools
openclaw config set tools.allow '["fs_read", "fs_write", "fetch", "bash"]'Usage
📋 Cách tham chiếu file trong chat
Cú pháp đúng:
# Cách 1: Path tuyệt đối (khuyến nghị)
"Phân tích file ~/openclaw-data/reports/q4-sales.csv"
# Cách 2: Path tương đối từ home
"Đọc file ./openclaw-data/meetings/2024-01-15-sprint.md"
# Cách 3: Multiple files
"So sánh file ~/openclaw-data/reports/q3.csv và ~/openclaw-data/reports/q4.csv"
# Cách 4: Folder (batch processing)
"Tóm tắt tất cả file trong ~/openclaw-data/invoices/"⚠️ Sai lầm thường gặp:
| Sai | Đúng | Giải thích |
|---|---|---|
/reports/file.csv | ~/openclaw-data/reports/file.csv | Thiếu home path |
file.csv | ./openclaw-data/reports/file.csv | Không có folder context |
C:\Users\... trên Linux | /home/user/... | Wrong OS path |
🔧 Xử lý lỗi thường gặp
Lỗi 1: File not found
Nguyên nhân: Path sai hoặc file không tồn tại
Fix:
ls -la ~/openclaw-data/reports/q4-sales.csv # Kiểm tra tồn tại
pwd # Xem current directoryLỗi 2: Permission denied
Nguyên nhân: OpenClaw không có quyền đọc
Fix:
chmod 644 ~/openclaw-data/reports/q4-sales.csv
# Hoặc nếu là file khác user:
sudo chown $USER:$USER ~/openclaw-data/reports/q4-sales.csvLỗi 3: File too large
Nguyên nhân: File > 10MB hoặc quá nhiều dòng
Fix:
# Chia nhỏ file
head -n 1000 ~/openclaw-data/reports/large.csv > ~/openclaw-data/reports/sample.csv
# Hoặc lấy sample
sed -n '1,100p' ~/openclaw-data/reports/large.csv > ~/openclaw-data/reports/head.csvLỗi 4: Unsupported encoding
Nguyên nhân: File không phải UTF-8
Fix:
# Chuyển encoding
iconv -f ISO-8859-1 -t UTF-8 ~/openclaw-data/reports/file.csv > ~/openclaw-data/reports/file-utf8.csv
# Kiểm tra encoding
file ~/openclaw-data/reports/file.csv💾 Xuất file từ OpenClaw
Khi OpenClaw tạo output, bạn có thể yêu cầu lưu file:
User: "Tạo báo cáo từ file CSV và lưu vào ~/openclaw-data/exports/"
OpenClaw: "Đã tạo báo cáo. Lưu vào ~/openclaw-data/exports/report-2024-01-15.md"Kiểm tra file đã tạo:
ls -la ~/openclaw-data/exports/
cat ~/openclaw-data/exports/report-2024-01-15.mdExample 1: Phân tích báo cáo
Slack: "Phân tích file ~/openclaw-data/reports/q4-sales.csv và cho tôi insights"
OpenClaw: 📊 **Q4 Sales Analysis**
Đã đọc file: ~/openclaw-data/reports/q4-sales.csv (245 rows)
**Key Insights**:
• Total Revenue: $1.2M (+15% YoY)
• Top Product: Enterprise License ($450K)
• Best Region: APAC (35% of total)
• Conversion Rate: 12.5% (up from 10.2%)
**Trends**:
📈 Revenue grew consistently each month
📈 Enterprise deals closing faster (avg 14 days)
📉 SMB churn slightly up (need attention)
**Recommendations**:
1. Double down on Enterprise marketing
2. Investigate SMB churn reasons
3. Expand APAC sales team
Want me to create a detailed report or charts?Example 2: Batch processing
Telegram: "Đọc tất cả file trong folder ~/openclaw-data/invoices/, tóm tắt tổng amount theo tháng"
OpenClaw: 💰 **Invoice Summary - Last 6 Months**
Đã xử lý 47 invoices:
| Month | Count | Total Amount |
| ----- | ----- | ------------ |
| Jul | 8 | $23,450 |
| Aug | 7 | $19,800 |
| Sep | 9 | $31,200 |
| Oct | 8 | $28,750 |
| Nov | 6 | $18,900 |
| Dec | 9 | $34,100 |
**Total**: $155,200
**Average/invoice**: $3,302
Lưu ý: Tháng 12 cao nhất do year-end renewals.
Want me to export this to a spreadsheet?Demo 4: Research Assistant - Web Search
Setup
# Bật browser tool
openclaw config set browser.enabled true
# Tùy chọn: Headless mode (không hiện cửa sổ browser)
openclaw config set browser.headless trueUsage
Example 1: Market Research
Discord: "Research về AI coding tools 2024, so sánh Cursor, Copilot, và Codeium"
OpenClaw: 🔍 **AI Coding Tools Comparison 2024**
**Cursor** (cursor.com)
• Pricing: $20/month (Pro)
• Strength: Context awareness, composer
• Weakness: Occasional latency
• Best for: Complex refactors
**GitHub Copilot** (github.com/copilot)
• Pricing: $10/month (Individual)
• Strength: Wide IDE support, autocomplete
• Weakness: Less context than Cursor
• Best for: Daily coding, boilerplate
**Codeium** (codeium.com)
• Pricing: Free tier available
• Strength: Fast, good autocomplete
• Weakness: Fewer advanced features
• Best for: Budget-conscious teams
**Recommendation**:
Start with Copilot ($10) for team,
then add Cursor ($20) for senior devs doing complex work.
Want detailed pros/cons or setup guides?Demo 5: Meeting Assistant
Setup
# Trong group Slack/Discord
openclaw config set channels.slack.groups.general.requireMention falseUsage
Slack #general: "Tóm tắt meeting notes từ file meetings/2024-01-15-sprint.md"
OpenClaw: 📝 **Meeting Summary - Sprint Planning**
👥 **Attendees**: John, Jane, Bob, Alice, Mike
🎯 **Topic**: Q1 Sprint 3 Planning
⏱️ **Duration**: 45 minutes
✅ **Completed**:
• Sprint 2 retro done
• Velocity: 34 points (consistent)
🚧 **Blockers**:
• API dependency from Platform team (ETA: Wed)
• AWS credits need approval
📋 **Action Items**:
┌─────────┬─────────────────────┬────────┐
│ Owner │ Task │ Due │
├─────────┼─────────────────────┼────────┤
│ John │ Fix auth bug #234 │ Jan 17 │
│ Jane │ Update API docs │ Jan 18 │
│ Bob │ Schedule user tests │ Jan 19 │
│ Alice │ Review PRs #120-125 │ Jan 17 │
│ Mike │ Chase AWS approval │ Jan 16 │
└─────────┴─────────────────────┴────────┘
Next meeting: Jan 22, 10:00 AMDemo 6: System Monitoring
Setup
# Bật system tools cho health check
openclaw config set tools.profile minimal
openclaw config set tools.allow '["exec", "bash", "shell"]'Usage
Example 1: Health Check
Telegram: "Check server status"
OpenClaw: 🖥️ **Server Health Check**Run: df -h Result: Disk 78% full (warning threshold)
Run: free -m Result: RAM 4.2G/8G used (52%)
Run: systemctl status openclaw Result: Active (running) since 3 days ago
Status: ⚠️ Warning
Issues: • Disk space at 78% - consider cleanup • 3 old log files > 1GB each • 2 zombie processes
Recommendations:
# Clean up old logs
openclaw logs cleanup --retention 7d
# Archive old sessions
openclaw sessions cleanup --max-age 30dRun these commands or shall I auto-fix?
Demo 7: Multi-Channel Workflow
Setup
# Cấu hình 3 channels
openclaw config set channels.telegram.botToken "${TELEGRAM_BOT_TOKEN}"
openclaw config set channels.discord.token "${DISCORD_BOT_TOKEN}"
openclaw config set channels.slack.botToken "${SLACK_BOT_TOKEN}"
# Bật identity link để share context
openclaw config set session.identityLinks.alice '["telegram:123", "discord:456", "slack:789"]'Usage
Cross-channel Context
09:00 - Telegram: "Alice: I'm working on the API migration"
14:00 - Discord: "Alice: @openclaw continue the API work"
OpenClaw (Discord): Continuing API migration context from Telegram this morning...
You mentioned working on database schema changes.
Progress update:
✅ User service migrated
🚧 Order service in progress
⏳ Payment service pending
Want me to generate the migration script for payment service?Demo 8: Automated Reminders
Setup
# Meeting reminders
openclaw cron add \
--name "standup-reminder" \
--schedule "0 9 * * 1-5" \
--message "Daily standup in 15 minutes! Prepare your updates: yesterday, today, blockers." \
--channel slack \
--to "#engineering"
# Weekly report
openclaw cron add \
--name "weekly-report" \
--schedule "0 17 * * 5" \
--message "Generate weekly summary of completed tasks and open PRs" \
--channel telegram \
--to "123456789"
# Server health check
openclaw cron add \
--name "health-check" \
--schedule "0 */4 * * *" \
--message "Run server health check: disk, memory, services. Alert if issues found." \
--delivery webhook \
--to "https://alerts.mycompany.com/webhook"Demo 9: Custom Commands
Setup
# Alias trong ~/.bashrc hoặc ~/.zshrc
alias oc='openclaw'
alias oc-logs='openclaw logs --tail 100'
alias oc-status='openclaw status'
alias oc-restart='openclaw gateway --port 18789'Quick Commands
# Khởi động nhanh
openclaw gateway --port 18789 &
# Gửi test message
openclaw message send \
--to telegram \
--to-id "123456789" \
--message "Test from CLI"
# Kiểm tra ngay lập tức
openclaw doctor && openclaw channels status
# Backup config trước khi thay đổi lớn
openclaw config export > backup-$(date +%Y%m%d-%H%M).json
# Xem logs real-time
openclaw logs --follow | grep ERRORTổng kết Commands
| Mục đích | Command |
|---|---|
| Khởi động | openclaw gateway --port 18789 |
| Wizard setup | openclaw onboard |
| Kiểm tra | openclaw doctor |
| Xem logs | openclaw logs --tail 100 |
| Cấu hình | openclaw config set <key> <value> |
| Test message | openclaw message send --to <channel> --message "test" |
| Cron job | openclaw cron add --name <name> --schedule <cron> |
| Backup | openclaw config export > backup.json |
Best Practices Demo
# 1. Luôn test trước khi production
openclaw doctor
openclaw channels test telegram
# 2. Bật pairing cho bot public
openclaw config set channels.telegram.dmPolicy "pairing"
# 3. Giới hạn allowlist
openclaw allowlist add telegram 123456789
# 4. Backup trước upgrade
openclaw config export > pre-upgrade.json
cp -r ~/.openclaw ~/openclaw-backup
# 5. Monitor health
openclaw status --watch