Skip to content

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

bash
# 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 18789

Usage

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

bash
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

bash
# 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:

  1. Database query returned null
  2. Missing authentication check
  3. Race condition in async call

Fix suggestion:

typescript
// src/controllers/user.ts:23
const user = await User.findById(id);
if (!user) {
  throw new NotFoundError("User not found");
}
return user.id; // Now safe

Should 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:

bash
# 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 upload

3. Định dạng file được hỗ trợ

Định dạngExtensionNotes
Text.txt, .md, .logTốt nhất cho phân tích
CSV.csvCó header, UTF-8 encoding
JSON.jsonPretty-printed hoặc minified
Code.js, .py, .ts, etc.Syntax highlighting trong response
Markdown.mdMeeting notes, tài liệu
PDF.pdfCần tools.pdf.enabled
Excel.xlsx, .xlsCầ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):

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 Inc

Yê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-DD format

Kiểm tra file:

bash
# 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.csv

5. Chuẩn bị Meeting Notes

File Markdown (~/openclaw-data/meetings/2024-01-15-sprint.md):

markdown
# 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

bash
# 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.csv

Setup

bash
# 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:

text
# 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ĐúngGiải thích
/reports/file.csv~/openclaw-data/reports/file.csvThiếu home path
file.csv./openclaw-data/reports/file.csvKhô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

text

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 directory

Lỗi 2: Permission denied

text

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.csv

Lỗi 3: File too large

text

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.csv

Lỗi 4: Unsupported encoding

text

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:

text
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:

bash
ls -la ~/openclaw-data/exports/
cat ~/openclaw-data/exports/report-2024-01-15.md

Example 1: Phân tích báo cáo

text
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

text
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?

Setup

bash
# 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 true

Usage

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

bash
# Trong group Slack/Discord
openclaw config set channels.slack.groups.general.requireMention false

Usage

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 AM

Demo 6: System Monitoring

Setup

bash
# 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:

bash
# Clean up old logs
openclaw logs cleanup --retention 7d

# Archive old sessions
openclaw sessions cleanup --max-age 30d

Run these commands or shall I auto-fix?


Demo 7: Multi-Channel Workflow

Setup

bash
# 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

bash
# 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

bash
# 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

bash
# 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 ERROR

Tổng kết Commands

Mục đíchCommand
Khởi độngopenclaw gateway --port 18789
Wizard setupopenclaw onboard
Kiểm traopenclaw doctor
Xem logsopenclaw logs --tail 100
Cấu hìnhopenclaw config set <key> <value>
Test messageopenclaw message send --to <channel> --message "test"
Cron jobopenclaw cron add --name <name> --schedule <cron>
Backupopenclaw config export > backup.json

Best Practices Demo

bash
# 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

Internal documentation for iNET Portal