awesome-openclaw-usecases-zh
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseawesome-openclaw-usecases-zh
awesome-openclaw-usecases-zh
Skill by ara.so — Hermes Skills collection.
A comprehensive Chinese-language reference for OpenClaw (formerly ClawdBot/MoltBot) use cases, featuring 50+ verified real-world scenarios for AI agent automation. This skill equips AI coding agents with knowledge of OpenClaw patterns, Chinese platform integrations, and production-ready implementations.
由ara.so提供的Skill — Hermes Skills合集。
这是一份面向中文用户的OpenClaw(前身为ClawdBot/MoltBot)用例综合参考资料,包含50+经过验证的AI Agent自动化真实场景。该Skill为AI编码Agent提供OpenClaw模式、中文平台集成及生产级实现的相关知识。
What This Project Provides
本项目提供的内容
awesome-openclaw-usecases-zh is a curated collection of OpenClaw use cases designed for Chinese users, including:
- 23 China-specific use cases: Feishu, DingTalk, WeChat Work, Xiaohongshu, A-share stock monitoring
- 27 international use cases (many with Chinese adaptations): social media, DevOps, productivity, research
- Structured format: Each use case includes pain points, capabilities, required skills, setup steps, and practical tips
- Agent-readable structure: Standardized markdown format suitable for AI consumption
awesome-openclaw-usecases-zh是为中文用户精心整理的OpenClaw用例集合,包括:
- 23个中国特有用例:飞书、钉钉、企业微信、小红书、A股股票监控
- 27个国际用例(多数适配中文场景):社交媒体、DevOps、生产力工具、研究
- 结构化格式:每个用例包含痛点、功能、所需技能、设置步骤及实用技巧
- Agent可读结构:标准化Markdown格式,适合AI读取
Core Concepts
核心概念
| Concept | English | Description |
|---|---|---|
| 工作区 | Workspace | Agent's working directory |
| 灵魂 | SOUL.md | Defines agent personality and boundaries |
| 操作手册 | AGENTS.md | Agent's operational instructions |
| 记忆 | Memory | Persistent context and preferences |
| 技能 | Skill | Reusable knowledge packages |
| 工具 | Tool | Specific capabilities (file ops, search, messaging) |
| 频道 | Channel | Platform connectors (Telegram, Feishu, Discord) |
| 提示词 | Prompt | User instructions to agent |
| 定时任务 | Cron Job | Scheduled automation |
| 心跳 | Heartbeat | Periodic status checks and reports |
| 子智能体 | Sub-agent | Parallel agent spawning |
| 概念 | English | Description |
|---|---|---|
| 工作区 | Workspace | Agent的工作目录 |
| 灵魂 | SOUL.md | 定义Agent的个性与边界 |
| 操作手册 | AGENTS.md | Agent的操作指南 |
| 记忆 | Memory | 持久化上下文与偏好设置 |
| 技能 | Skill | 可复用的知识包 |
| 工具 | Tool | 特定能力(文件操作、搜索、消息发送) |
| 频道 | Channel | 平台连接器(Telegram、飞书、Discord) |
| 提示词 | Prompt | 用户向Agent发出的指令 |
| 定时任务 | Cron Job | 定时自动化任务 |
| 心跳 | Heartbeat | 定期状态检查与报告 |
| 子智能体 | Sub-agent | 并行Agent生成 |
Installation & Access
安装与访问
The repository is hosted on GitHub and AtomGit (China mirror):
bash
undefined本仓库托管在GitHub及AtomGit(国内镜像):
bash
undefinedClone from GitHub
Clone from GitHub
Clone from AtomGit (China)
Clone from AtomGit (China)
undefinedundefinedRepository Structure
仓库结构
awesome-openclaw-usecases-zh/
├── README.md # Main index with 50+ use cases
├── CONTRIBUTING.md # Contribution guidelines
├── AGENT-GUIDE.md # Guide for AI agents to use this repo
├── usecases/
│ ├── cn-*.md # China-specific use cases (23)
│ ├── *.md # International use cases (27)
│ └── images/ # Screenshots and diagrams
└── templates/
└── usecase-template.md # Standard use case formatawesome-openclaw-usecases-zh/
├── README.md # 包含50+用例的主索引
├── CONTRIBUTING.md # 贡献指南
├── AGENT-GUIDE.md # AI Agent使用本仓库的指南
├── usecases/
│ ├── cn-*.md # 中国特有用例(23个)
│ ├── *.md # 国际用例(27个)
│ └── images/ # 截图与图表
└── templates/
└── usecase-template.md # 标准用例模板Use Case Categories
用例分类
🇨🇳 China-Specific (23 cases)
🇨🇳 中国特有用例(23个)
Platform Bots (4)
- - Feishu/Lark bot integration
cn-feishu-ai-assistant.md - - Lark CLI for agent operations (200+ commands)
cn-feishu-lark-cli.md - - DingTalk bot (Stream mode)
cn-dingtalk-ai-assistant.md - - WeChat Work bot
cn-wecom-ai-assistant.md
Content Creation (3)
- - Xiaohongshu publishing pipeline
cn-xiaohongshu-automation.md - - WeChat Official Account automation
cn-wechat-mp-automation.md - - Podcast workflow (Ximalaya/Bilibili)
podcast-production-pipeline.md
Data & Research (7)
- - A-share stock monitoring (AKShare)
cn-a-share-monitor.md - - Earnings reports (Chinese stocks)
earnings-tracker.md - - Competitor analysis (Baidu Index, WeChat Index)
competitive-intelligence.md - - 8 Chinese platform aggregation
cn-internet-research-30days.md - - HuggingFace papers (Chinese mirrors)
hf-papers-research-discovery.md - - arXiv + LaTeX (Chinese templates)
arxiv-paper-reader-latex-writer.md
Office & Customer Service (4)
- - Email, files, meeting notes (163/QQ/Outlook)
cn-office-automation.md - - Meeting transcription (Feishu/Tencent/DingTalk)
meeting-notes-action-items.md - - Multi-channel support
multi-channel-customer-service.md - - E-commerce multi-agent architecture
cn-ecommerce-multi-agent.md
Personal Assistant (5)
- - Daily briefing (Chinese news sources)
custom-morning-brief.md - - Personality extraction (12+ platforms)
digital-persona-distillation.md - - Multi-agent OS architecture
cn-multi-agent-operating-system.md - - Agent swarm development team
agent-swarm-dev-team.md - - Agent dashboard (web UI)
multica-managed-agents.md
平台机器人(4个)
- - 飞书/Lark机器人集成
cn-feishu-ai-assistant.md - - 用于Agent操作的Lark CLI(200+命令)
cn-feishu-lark-cli.md - - 钉钉机器人(流模式)
cn-dingtalk-ai-assistant.md - - 企业微信机器人
cn-wecom-ai-assistant.md
内容创作(3个)
- - 小红书发布流程自动化
cn-xiaohongshu-automation.md - - 微信公众号自动化
cn-wechat-mp-automation.md - - 播客制作流程(喜马拉雅/B站)
podcast-production-pipeline.md
数据与研究(7个)
- - A股股票监控(AKShare)
cn-a-share-monitor.md - - 财报追踪(中国股票)
earnings-tracker.md - - 竞品分析(百度指数、微信指数)
competitive-intelligence.md - - 8个中文平台聚合研究
cn-internet-research-30days.md - - HuggingFace论文(国内镜像)
hf-papers-research-discovery.md - - arXiv + LaTeX(中文模板)
arxiv-paper-reader-latex-writer.md
办公与客户服务(4个)
- - 邮件、文件、会议纪要(163/QQ/Outlook)
cn-office-automation.md - - 会议转录(飞书/腾讯会议/钉钉)
meeting-notes-action-items.md - - 多渠道客服支持
multi-channel-customer-service.md - - 电商多Agent架构
cn-ecommerce-multi-agent.md
个人助手(5个)
- - 每日简报(中文新闻源)
custom-morning-brief.md - - 个性提取(12+平台)
digital-persona-distillation.md - - 多Agent操作系统架构
cn-multi-agent-operating-system.md - - Agent集群开发团队
agent-swarm-dev-team.md - - Agent控制面板(Web UI)
multica-managed-agents.md
🌐 International (27 cases)
🌐 国际用例(27个)
Social Media (4) - Reddit, YouTube, X aggregation
Creative & Building (3) - Content pipelines, product building
Infrastructure & DevOps (5) - Server self-healing, observability, workflow orchestration
Productivity (16) - Email, calendar, notes, CRM, personal assistant
Research & Learning (9) - Knowledge bases, market research, competitive analysis
Finance & Trading (1) - Prediction market simulation
Creative & Building (3) - Content pipelines, product building
Infrastructure & DevOps (5) - Server self-healing, observability, workflow orchestration
Productivity (16) - Email, calendar, notes, CRM, personal assistant
Research & Learning (9) - Knowledge bases, market research, competitive analysis
Finance & Trading (1) - Prediction market simulation
社交媒体(4个) - Reddit、YouTube、X聚合
创意与构建(3个) - 内容流程、产品构建
基础设施与DevOps(5个) - 服务器自愈、可观测性、工作流编排
生产力工具(16个) - 邮件、日历、笔记、CRM、个人助手
研究与学习(9个) - 知识库、市场研究、竞品分析
金融与交易(1个) - 预测市场模拟
创意与构建(3个) - 内容流程、产品构建
基础设施与DevOps(5个) - 服务器自愈、可观测性、工作流编排
生产力工具(16个) - 邮件、日历、笔记、CRM、个人助手
研究与学习(9个) - 知识库、市场研究、竞品分析
金融与交易(1个) - 预测市场模拟
Reading Use Cases
用例阅读指南
Each use case follows this structure:
markdown
---
difficulty: ⭐ (copy-paste) | ⭐⭐ (config needed) | ⭐⭐⭐ (technical)
platform: [feishu|dingtalk|wecom|xiaohongshu|...]
tags: [automation, content-creation, ...]
---每个用例遵循以下结构:
markdown
---
difficulty: ⭐ (复制粘贴即可) | ⭐⭐ (需配置) | ⭐⭐⭐ (技术型)
platform: [feishu|dingtalk|wecom|xiaohongshu|...]
tags: [automation, content-creation, ...]
---Use Case Title
用例标题
痛点 (Pain Points)
痛点 (Pain Points)
What problem this solves
解决的问题
它能做什么 (Capabilities)
它能做什么 (Capabilities)
- Feature 1
- Feature 2
- 功能1
- 功能2
所需技能 (Required Skills)
所需技能 (Required Skills)
- Skill package 1
- Skill package 2
- Skill包1
- Skill包2
如何设置 (Setup)
如何设置 (Setup)
Step-by-step configuration with copy-paste prompts
带复制粘贴提示词的分步配置指南
实用建议 (Practical Tips)
实用建议 (Practical Tips)
Best practices and pitfalls
undefined最佳实践与常见陷阱
undefinedKey Patterns for AI Agents
AI Agent核心模式
1. Chinese Platform Integration
1. 中文平台集成
Feishu Bot Example ():
cn-feishu-ai-assistant.mdjavascript
// Install official Feishu SDK
npm install @larksuiteoapi/node-sdk
// Initialize bot
const lark = require('@larksuiteoapi/node-sdk');
const client = new lark.Client({
appId: process.env.FEISHU_APP_ID,
appSecret: process.env.FEISHU_APP_SECRET,
});
// Handle incoming messages
app.post('/webhook', async (req, res) => {
const { event } = req.body;
if (event.type === 'message') {
const { message_id, content } = event.message;
const userInput = JSON.parse(content).text;
// Send to OpenClaw agent
const response = await openclawAgent.process(userInput);
// Reply in Feishu
await client.im.message.reply({
message_id,
content: JSON.stringify({ text: response }),
msg_type: 'text',
});
}
res.json({ ok: true });
});DingTalk Stream Mode ():
cn-dingtalk-ai-assistant.mdpython
undefined飞书机器人示例 ():
cn-feishu-ai-assistant.mdjavascript
// Install official Feishu SDK
npm install @larksuiteoapi/node-sdk
// Initialize bot
const lark = require('@larksuiteoapi/node-sdk');
const client = new lark.Client({
appId: process.env.FEISHU_APP_ID,
appSecret: process.env.FEISHU_APP_SECRET,
});
// Handle incoming messages
app.post('/webhook', async (req, res) => {
const { event } = req.body;
if (event.type === 'message') {
const { message_id, content } = event.message;
const userInput = JSON.parse(content).text;
// Send to OpenClaw agent
const response = await openclawAgent.process(userInput);
// Reply in Feishu
await client.im.message.reply({
message_id,
content: JSON.stringify({ text: response }),
msg_type: 'text',
});
}
res.json({ ok: true });
});钉钉流模式 ():
cn-dingtalk-ai-assistant.mdpython
undefinedNo public IP needed - uses WebSocket
No public IP needed - uses WebSocket
from dingtalk_stream import AckMessage
import dingtalk_stream
def message_handler(dingtalk_client, message):
content = message.text.content.strip()
# Process with OpenClaw
response = openclaw_agent.process(content)
# Reply
dingtalk_client.send_text_message(
message.sender_id,
response
)
return AckMessage.STATUS_OKfrom dingtalk_stream import AckMessage
import dingtalk_stream
def message_handler(dingtalk_client, message):
content = message.text.content.strip()
# Process with OpenClaw
response = openclaw_agent.process(content)
# Reply
dingtalk_client.send_text_message(
message.sender_id,
response
)
return AckMessage.STATUS_OKStart Stream listener
Start Stream listener
client = dingtalk_stream.DingTalkStreamClient(
client_id=os.getenv('DINGTALK_CLIENT_ID'),
client_secret=os.getenv('DINGTALK_CLIENT_SECRET')
)
client.register_callback_handler('chatbot', message_handler)
client.start_forever()
undefinedclient = dingtalk_stream.DingTalkStreamClient(
client_id=os.getenv('DINGTALK_CLIENT_ID'),
client_secret=os.getenv('DINGTALK_CLIENT_SECRET')
)
client.register_callback_handler('chatbot', message_handler)
client.start_forever()
undefined2. Lark CLI Integration (cn-feishu-lark-cli.md
)
cn-feishu-lark-cli.md2. Lark CLI集成 (cn-feishu-lark-cli.md
)
cn-feishu-lark-cli.mdAgents can use Lark CLI to operate Feishu as the user:
bash
undefinedAgent可使用Lark CLI以用户身份操作飞书:
bash
undefinedInstall Lark CLI
Install Lark CLI
pip install lark-cli
pip install lark-cli
Configure authentication
Configure authentication
export LARK_APP_ID="your_app_id"
export LARK_APP_SECRET="your_app_secret"
export LARK_USER_ACCESS_TOKEN="your_token"
export LARK_APP_ID="your_app_id"
export LARK_APP_SECRET="your_app_secret"
export LARK_USER_ACCESS_TOKEN="your_token"
Search documents
Search documents
lark-cli docx search --keyword "项目文档"
lark-cli docx search --keyword "项目文档"
Read meeting notes
Read meeting notes
lark-cli meeting-minutes list --date 2026-05-01
lark-cli meeting-minutes list --date 2026-05-01
Get calendar events
Get calendar events
lark-cli calendar events --start-date 2026-05-16 --end-date 2026-05-17
lark-cli calendar events --start-date 2026-05-16 --end-date 2026-05-17
Send message
Send message
lark-cli message send --user-id "ou_xxx" --text "任务已完成"
**OpenClaw Skill Integration**:
```markdownlark-cli message send --user-id "ou_xxx" --text "任务已完成"
**OpenClaw Skill集成**:
```markdownAvailable Tools
Available Tools
- : Search Feishu documents
lark_cli_search - : Query calendar events
lark_cli_calendar - : Send notifications
lark_cli_message
- : 搜索飞书文档
lark_cli_search - : 查询日历事件
lark_cli_calendar - : 发送通知
lark_cli_message
Example Prompt
Example Prompt
Search for project documentation related to "AI Agent" in Feishu and summarize the top 3 results.
在飞书中搜索与"AI Agent"相关的项目文档,并总结前3个结果。
Agent Execution
Agent Execution
- Run:
lark-cli docx search --keyword "AI Agent" --limit 3 - Parse JSON output
- For each doc, fetch content:
lark-cli docx get --doc-id {id} - Summarize and return
undefined- 运行:
lark-cli docx search --keyword "AI Agent" --limit 3 - 解析JSON输出
- 对每个文档,获取内容:
lark-cli docx get --doc-id {id} - 总结并返回结果
undefined3. A-Share Stock Monitoring (cn-a-share-monitor.md
)
cn-a-share-monitor.md3. A股股票监控 (cn-a-share-monitor.md
)
cn-a-share-monitor.mdpython
undefinedpython
undefinedUsing AKShare (free, no API key needed)
Using AKShare (free, no API key needed)
import akshare as ak
from datetime import datetime
def get_market_overview():
"""Pre-market briefing"""
# Get index data
sh_index = ak.stock_zh_index_daily(symbol="sh000001")
latest = sh_index.iloc[-1]
# Get sector money flow
sectors = ak.stock_sector_fund_flow_rank(indicator="今日")
top_sectors = sectors.head(5)
return {
"sh_index": {
"close": latest['close'],
"change": latest['close'] - latest['open'],
"volume": latest['volume']
},
"top_sectors": top_sectors.to_dict('records')
}def post_market_review():
"""Post-market analysis"""
# Get individual stock rankings
gainers = ak.stock_zh_a_spot_em().nlargest(10, 'pct_chg')
losers = ak.stock_zh_a_spot_em().nsmallest(10, 'pct_chg')
return {
"gainers": gainers[['code', 'name', 'pct_chg']].to_dict('records'),
"losers": losers[['code', 'name', 'pct_chg']].to_dict('records')
}import akshare as ak
from datetime import datetime
def get_market_overview():
"""盘前简报"""
# Get index data
sh_index = ak.stock_zh_index_daily(symbol="sh000001")
latest = sh_index.iloc[-1]
# Get sector money flow
sectors = ak.stock_sector_fund_flow_rank(indicator="今日")
top_sectors = sectors.head(5)
return {
"sh_index": {
"close": latest['close'],
"change": latest['close'] - latest['open'],
"volume": latest['volume']
},
"top_sectors": top_sectors.to_dict('records')
}def post_market_review():
"""盘后分析"""
# Get individual stock rankings
gainers = ak.stock_zh_a_spot_em().nlargest(10, 'pct_chg')
losers = ak.stock_zh_a_spot_em().nsmallest(10, 'pct_chg')
return {
"gainers": gainers[['code', 'name', 'pct_chg']].to_dict('records'),
"losers": losers[['code', 'name', 'pct_chg']].to_dict('records')
}Cron schedule in OpenClaw
Cron schedule in OpenClaw
8:30 AM: Send pre-market briefing to Feishu
8:30 AM: 发送盘前简报至飞书
3:30 PM: Send post-market review to Feishu
3:30 PM: 发送盘后分析至飞书
undefinedundefined4. Multi-Agent Architecture (cn-multi-agent-operating-system.md
)
cn-multi-agent-operating-system.md4. 多Agent架构 (cn-multi-agent-operating-system.md
)
cn-multi-agent-operating-system.mdCore Pattern:
yaml
undefined核心模式:
yaml
undefinedworkspace/AGENTS.md structure
workspace/AGENTS.md structure
agents:
-
name: coordinator role: Task decomposition and delegation memory: Global context
-
name: researcher role: Information gathering skills: [web-search, pdf-reader]
-
name: writer role: Content generation skills: [markdown-writer, seo-optimizer]
-
name: publisher role: Platform distribution skills: [feishu-bot, xiaohongshu-api]
workflow:
- User sends request to coordinator
- Coordinator spawns sub-agents
- Sub-agents report back to coordinator
- Coordinator synthesizes final output
**Implementation Example**:
```javascript
// Coordinator agent prompt
const coordinatorPrompt = `
You are a coordinator. When given a task:
1. Break it into subtasks
2. Assign each to a specialist sub-agent:
- @researcher for data collection
- @writer for content creation
- @publisher for distribution
3. Collect results and synthesize
4. Return final output
Current task: Create and publish a Xiaohongshu post about OpenClaw
`;
// Spawn sub-agents
const researchResult = await spawnAgent('researcher', {
task: 'Find trending OpenClaw use cases',
tools: ['perplexity_search', 'github_trending']
});
const content = await spawnAgent('writer', {
task: 'Write Xiaohongshu post',
context: researchResult,
tools: ['markdown_formatter', 'emoji_suggester']
});
const published = await spawnAgent('publisher', {
task: 'Publish to Xiaohongshu',
content: content,
tools: ['xiaohongshu_api']
});agents:
-
name: coordinator role: Task decomposition and delegation memory: Global context
-
name: researcher role: Information gathering skills: [web-search, pdf-reader]
-
name: writer role: Content generation skills: [markdown-writer, seo-optimizer]
-
name: publisher role: Platform distribution skills: [feishu-bot, xiaohongshu-api]
workflow:
- User sends request to coordinator
- Coordinator spawns sub-agents
- Sub-agents report back to coordinator
- Coordinator synthesizes final output
**实现示例**:
```javascript
// Coordinator agent prompt
const coordinatorPrompt = `
你是一名协调者。收到任务时:
1. 将任务拆解为子任务
2. 将每个子任务分配给专业子Agent:
- @researcher 负责数据收集
- @writer 负责内容创作
- @publisher 负责分发
3. 收集结果并整合
4. 返回最终输出
当前任务:创建一篇关于OpenClaw的小红书笔记并发布
`;
// Spawn sub-agents
const researchResult = await spawnAgent('researcher', {
task: '查找热门OpenClaw用例',
tools: ['perplexity_search', 'github_trending']
});
const content = await spawnAgent('writer', {
task: '撰写小红书笔记',
context: researchResult,
tools: ['markdown_formatter', 'emoji_suggester']
});
const published = await spawnAgent('publisher', {
task: '发布至小红书',
content: content,
tools: ['xiaohongshu_api']
});5. Xiaohongshu Automation (cn-xiaohongshu-automation.md
)
cn-xiaohongshu-automation.md5. 小红书自动化 (cn-xiaohongshu-automation.md
)
cn-xiaohongshu-automation.mdpython
undefinedpython
undefinedUnofficial API (use with caution, rate limits apply)
Unofficial API (use with caution, rate limits apply)
from xhs import XhsClient
client = XhsClient(
cookie=os.getenv('XHS_COOKIE'), # Get from browser
)
def publish_note(title, content, images, tags):
"""Publish note to Xiaohongshu"""
# Upload images first
image_ids = []
for img_path in images:
with open(img_path, 'rb') as f:
result = client.upload_image(f.read())
image_ids.append(result['image_id'])
# Create note
note = client.create_note(
title=title,
desc=content,
image_ids=image_ids,
tags=tags,
post_time=None, # Publish immediately, or set timestamp
is_private=False
)
return note['note_id']from xhs import XhsClient
client = XhsClient(
cookie=os.getenv('XHS_COOKIE'), # Get from browser
)
def publish_note(title, content, images, tags):
"""发布笔记至小红书"""
# Upload images first
image_ids = []
for img_path in images:
with open(img_path, 'rb') as f:
result = client.upload_image(f.read())
image_ids.append(result['image_id'])
# Create note
note = client.create_note(
title=title,
desc=content,
image_ids=image_ids,
tags=tags,
post_time=None, # 立即发布,或设置时间戳
is_private=False
)
return note['note_id']OpenClaw scheduled task
OpenClaw scheduled task
Daily 7PM: Generate trending topic post
每日晚7点:生成热门话题笔记
Use DALL-E for cover image
使用DALL-E生成封面图
Auto-publish with optimal hashtags
自动发布并使用最优话题标签
undefinedundefined6. WeChat Official Account (cn-wechat-mp-automation.md
)
cn-wechat-mp-automation.md6. 微信公众号 (cn-wechat-mp-automation.md
)
cn-wechat-mp-automation.mdpython
undefinedpython
undefinedUsing wechatpy library
Using wechatpy library
from wechatpy import WeChatClient
from wechatpy.client.api import WeChatMedia, WeChatMaterial
client = WeChatClient(
appid=os.getenv('WECHAT_APPID'),
secret=os.getenv('WECHAT_SECRET')
)
def markdown_to_wechat_html(md_content):
"""Convert Markdown to WeChat-styled HTML"""
import markdown2
html = markdown2.markdown(md_content, extras=['fenced-code-blocks'])
# Apply WeChat styling
styled_html = f"""
<section style="font-size: 16px; color: #333;">
{html}
</section>
"""
return styled_htmldef create_draft(title, content, thumb_media_id):
"""Create draft article"""
articles = [{
'title': title,
'author': 'OpenClaw Bot',
'digest': content[:100],
'content': markdown_to_wechat_html(content),
'thumb_media_id': thumb_media_id,
'show_cover_pic': 1,
}]
result = client.material.add_news(articles)
return result['media_id']from wechatpy import WeChatClient
from wechatpy.client.api import WeChatMedia, WeChatMaterial
client = WeChatClient(
appid=os.getenv('WECHAT_APPID'),
secret=os.getenv('WECHAT_SECRET')
)
def markdown_to_wechat_html(md_content):
"""将Markdown转换为微信风格HTML"""
import markdown2
html = markdown2.markdown(md_content, extras=['fenced-code-blocks'])
# 应用微信样式
styled_html = f"""
<section style="font-size: 16px; color: #333;">
{html}
</section>
"""
return styled_htmldef create_draft(title, content, thumb_media_id):
"""创建草稿文章"""
articles = [{
'title': title,
'author': 'OpenClaw Bot',
'digest': content[:100],
'content': markdown_to_wechat_html(content),
'thumb_media_id': thumb_media_id,
'show_cover_pic': 1,
}]
result = client.material.add_news(articles)
return result['media_id']OpenClaw automation
OpenClaw自动化流程
1. Agent writes article in Markdown
1. Agent使用Markdown撰写文章
2. Convert to WeChat HTML
2. 转换为微信HTML格式
3. Upload cover image
3. 上传封面图
4. Create draft (manual review before publish)
4. 创建草稿(发布前需人工审核)
undefinedundefined7. Meeting Notes Automation (meeting-notes-action-items.md
)
meeting-notes-action-items.md7. 会议纪要自动化 (meeting-notes-action-items.md
)
meeting-notes-action-items.mdFeishu Integration:
javascript
// Get meeting transcript from Feishu
const getMeetingTranscript = async (meetingId) => {
const response = await fetch(
`https://open.feishu.cn/open-apis/vc/v1/meetings/${meetingId}/recording`,
{
headers: {
Authorization: `Bearer ${process.env.FEISHU_TENANT_TOKEN}`,
},
}
);
const data = await response.json();
return data.data.recording_url;
};
// Download and transcribe
const transcription = await whisperAPI.transcribe(recordingUrl);
// OpenClaw processes transcript
const prompt = `
Analyze this meeting transcript and generate:
1. Summary (3-5 sentences)
2. Key decisions made
3. Action items with owners and deadlines
4. Follow-up questions
Transcript:
${transcription}
`;
const analysis = await openclawAgent.process(prompt);
// Create Feishu tasks automatically
for (const actionItem of analysis.action_items) {
await feishuClient.task.create({
summary: actionItem.task,
due_date: actionItem.deadline,
assignee: actionItem.owner,
});
}飞书集成:
javascript
// Get meeting transcript from Feishu
const getMeetingTranscript = async (meetingId) => {
const response = await fetch(
`https://open.feishu.cn/open-apis/vc/v1/meetings/${meetingId}/recording`,
{
headers: {
Authorization: `Bearer ${process.env.FEISHU_TENANT_TOKEN}`,
},
}
);
const data = await response.json();
return data.data.recording_url;
};
// Download and transcribe
const transcription = await whisperAPI.transcribe(recordingUrl);
// OpenClaw processes transcript
const prompt = `
分析这份会议转录内容,生成:
1. 总结(3-5句话)
2. 做出的关键决策
3. 带负责人和截止日期的行动项
4. 后续问题
转录内容:
${transcription}
`;
const analysis = await openclawAgent.process(prompt);
// 自动创建飞书任务
for (const actionItem of analysis.action_items) {
await feishuClient.task.create({
summary: actionItem.task,
due_date: actionItem.deadline,
assignee: actionItem.owner,
});
}8. Digital Persona Extraction (digital-persona-distillation.md
)
digital-persona-distillation.md8. 数字个性提取 (digital-persona-distillation.md
)
digital-persona-distillation.mdpython
undefinedpython
undefinedExtract chat history from multiple platforms
Extract chat history from multiple platforms
def extract_wechat_history():
"""Extract from WeChat PC backup"""
import sqlite3
conn = sqlite3.connect('WeChat/Msg/Multi/MSG0.db')
cursor = conn.cursor()
cursor.execute("""
SELECT strftime('%Y-%m-%d', CreateTime, 'unixepoch'),
Message, IsSender
FROM MSG
WHERE Type = 1 -- Text messages only
ORDER BY CreateTime DESC
LIMIT 10000
""")
messages = cursor.fetchall()
return [{'date': m[0], 'text': m[1], 'is_sender': m[2]}
for m in messages]def extract_feishu_history():
"""Extract from Feishu via API"""
messages = lark_client.im.message.list(
container_id_type='chat',
container_id=os.getenv('FEISHU_CHAT_ID'),
page_size=100
)
return messages
def extract_wechat_history():
"""从微信PC备份中提取"""
import sqlite3
conn = sqlite3.connect('WeChat/Msg/Multi/MSG0.db')
cursor = conn.cursor()
cursor.execute("""
SELECT strftime('%Y-%m-%d', CreateTime, 'unixepoch'),
Message, IsSender
FROM MSG
WHERE Type = 1 -- 仅文本消息
ORDER BY CreateTime DESC
LIMIT 10000
""")
messages = cursor.fetchall()
return [{'date': m[0], 'text': m[1], 'is_sender': m[2]}
for m in messages]def extract_feishu_history():
"""通过API从飞书提取"""
messages = lark_client.im.message.list(
container_id_type='chat',
container_id=os.getenv('FEISHU_CHAT_ID'),
page_size=100
)
return messages
Aggregate all sources
聚合所有来源
all_messages = []
all_messages.extend(extract_wechat_history())
all_messages.extend(extract_feishu_history())
all_messages.extend(extract_telegram_history()) # etc.
all_messages = []
all_messages.extend(extract_wechat_history())
all_messages.extend(extract_feishu_history())
all_messages.extend(extract_telegram_history()) # 其他平台等
OpenClaw analysis prompt
OpenClaw分析提示词
persona_prompt = f"""
Analyze these {len(all_messages)} messages and extract:
-
Communication Style
- Tone (formal/casual/humorous)
- Vocabulary patterns
- Common phrases
-
Values & Beliefs
- Recurring themes
- Priorities
- Decision-making patterns
-
Interests & Expertise
- Topics frequently discussed
- Knowledge domains
-
Behavioral Patterns
- Response time preferences
- Message length
- Emoji usage
Messages:
{json.dumps(all_messages[:1000])} # Sample for token limits
"""
persona = await openclawAgent.process(persona_prompt)
persona_prompt = f"""
分析这{len(all_messages)}条消息,提取:
-
沟通风格
- 语气(正式/随意/幽默)
- 词汇模式
- 常用短语
-
价值观与信念
- 重复出现的主题
- 优先级
- 决策模式
-
兴趣与专长
- 频繁讨论的话题
- 知识领域
-
行为模式
- 回复时间偏好
- 消息长度
- 表情使用
消息:
{json.dumps(all_messages[:1000])} # 受token限制,取样本
"""
persona = await openclawAgent.process(persona_prompt)
Save to SOUL.md for future interactions
保存至SOUL.md用于未来交互
undefinedundefinedEnvironment Variables Reference
环境变量参考
Common environment variables across use cases:
bash
undefined各用例通用的环境变量:
bash
undefinedFeishu/Lark
Feishu/Lark
FEISHU_APP_ID=cli_xxx
FEISHU_APP_SECRET=xxx
FEISHU_TENANT_TOKEN=t-xxx
LARK_USER_ACCESS_TOKEN=u-xxx
FEISHU_APP_ID=cli_xxx
FEISHU_APP_SECRET=xxx
FEISHU_TENANT_TOKEN=t-xxx
LARK_USER_ACCESS_TOKEN=u-xxx
DingTalk
DingTalk
DINGTALK_CLIENT_ID=xxx
DINGTALK_CLIENT_SECRET=xxx
DINGTALK_ROBOT_TOKEN=xxx
DINGTALK_CLIENT_ID=xxx
DINGTALK_CLIENT_SECRET=xxx
DINGTALK_ROBOT_TOKEN=xxx
WeChat Work
WeChat Work
WECOM_CORP_ID=xxx
WECOM_AGENT_ID=xxx
WECOM_SECRET=xxx
WECOM_CORP_ID=xxx
WECOM_AGENT_ID=xxx
WECOM_SECRET=xxx
WeChat Official Account
WeChat Official Account
WECHAT_APPID=xxx
WECHAT_SECRET=xxx
WECHAT_APPID=xxx
WECHAT_SECRET=xxx
Xiaohongshu
Xiaohongshu
XHS_COOKIE="your_browser_cookie"
XHS_COOKIE="your_browser_cookie"
Stock Data (AKShare is free, no key needed)
Stock Data (AKShare is free, no key needed)
But if using alternatives:
But if using alternatives:
TUSHARE_TOKEN=xxx
TUSHARE_TOKEN=xxx
OpenClaw
OpenClaw
OPENCLAW_WORKSPACE=/path/to/workspace
OPENCLAW_API_KEY=sk-xxx # If using hosted version
OPENCLAW_WORKSPACE=/path/to/workspace
OPENCLAW_API_KEY=sk-xxx # If using hosted version
LLM Providers
LLM Providers
OPENAI_API_KEY=sk-xxx
ANTHROPIC_API_KEY=sk-ant-xxx
DEEPSEEK_API_KEY=sk-xxx # Chinese LLM
ZHIPU_API_KEY=xxx # GLM model
undefinedOPENAI_API_KEY=sk-xxx
ANTHROPIC_API_KEY=sk-ant-xxx
DEEPSEEK_API_KEY=sk-xxx # 中文LLM
ZHIPU_API_KEY=xxx # GLM模型
undefinedTroubleshooting
故障排除
Chinese Platform Rate Limits
中文平台速率限制
Issue: Feishu/DingTalk API rate limits
Solution:
Solution:
python
import time
from functools import wraps
def rate_limit(calls_per_minute=60):
min_interval = 60.0 / calls_per_minute
last_called = [0.0]
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
elapsed = time.time() - last_called[0]
if elapsed < min_interval:
time.sleep(min_interval - elapsed)
result = func(*args, **kwargs)
last_called[0] = time.time()
return result
return wrapper
return decorator
@rate_limit(calls_per_minute=50)
def call_feishu_api():
# Your API call
pass问题:飞书/钉钉API速率受限
解决方案:
解决方案:
python
import time
from functools import wraps
def rate_limit(calls_per_minute=60):
min_interval = 60.0 / calls_per_minute
last_called = [0.0]
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
elapsed = time.time() - last_called[0]
if elapsed < min_interval:
time.sleep(min_interval - elapsed)
result = func(*args, **kwargs)
last_called[0] = time.time()
return result
return wrapper
return decorator
@rate_limit(calls_per_minute=50)
def call_feishu_api():
# Your API call
passAKShare Data Reliability
AKShare数据可靠性
Issue: AKShare data sometimes has delays
Solution: Add fallback data sources
Solution: Add fallback data sources
python
def get_stock_data(symbol, retries=3):
try:
return ak.stock_zh_a_hist(symbol=symbol)
except Exception as e:
if retries > 0:
time.sleep(2)
return get_stock_data(symbol, retries - 1)
else:
# Fallback to manual data source
return fetch_from_tushare(symbol)问题:AKShare数据有时存在延迟
解决方案:添加备用数据源
解决方案:添加备用数据源
python
def get_stock_data(symbol, retries=3):
try:
return ak.stock_zh_a_hist(symbol=symbol)
except Exception as e:
if retries > 0:
time.sleep(2)
return get_stock_data(symbol, retries - 1)
else:
# Fallback to manual data source
return fetch_from_tushare(symbol)WeChat Cookie Expiration
微信Cookie过期
Issue: Xiaohongshu/WeChat cookies expire frequently
Solution: Implement cookie refresh
Solution: Implement cookie refresh
python
import browser_cookie3
def refresh_cookie(domain):
"""Auto-refresh cookie from browser"""
cookies = browser_cookie3.chrome(domain_name=domain)
cookie_str = '; '.join([f'{c.name}={c.value}' for c in cookies])
return cookie_str问题:小红书/微信Cookie频繁过期
解决方案:实现Cookie刷新
解决方案:实现Cookie刷新
python
import browser_cookie3
def refresh_cookie(domain):
"""从浏览器自动刷新Cookie"""
cookies = browser_cookie3.chrome(domain_name=domain)
cookie_str = '; '.join([f'{c.name}={c.value}' for c in cookies])
return cookie_strUse in OpenClaw heartbeat
在OpenClaw心跳任务中使用
def heartbeat_check():
global xhs_cookie
xhs_cookie = refresh_cookie('.xiaohongshu.com')
undefineddef heartbeat_check():
global xhs_cookie
xhs_cookie = refresh_cookie('.xiaohongshu.com')
undefinedMulti-Agent Memory Conflicts
多Agent内存冲突
Issue: Sub-agents overwriting shared memory
Solution: Namespace memory by agent
Solution: Namespace memory by agent
javascript
// In AGENTS.md
memory_strategy: {
coordinator: "workspace/memory/coordinator.json",
researcher: "workspace/memory/researcher.json",
writer: "workspace/memory/writer.json",
}
// Code
async function saveAgentMemory(agentName, data) {
const memoryPath = `workspace/memory/${agentName}.json`;
await fs.writeFile(memoryPath, JSON.stringify(data, null, 2));
}问题:子Agent覆盖共享内存
解决方案:按Agent划分内存命名空间
解决方案:按Agent划分内存命名空间
javascript
// In AGENTS.md
memory_strategy: {
coordinator: "workspace/memory/coordinator.json",
researcher: "workspace/memory/researcher.json",
writer: "workspace/memory/writer.json",
}
// Code
async function saveAgentMemory(agentName, data) {
const memoryPath = `workspace/memory/${agentName}.json`;
await fs.writeFile(memoryPath, JSON.stringify(data, null, 2));
}Best Practices
最佳实践
-
Security: Never hardcode credentials. Use environment variables or secret management tools.
-
Chinese Text Encoding: Always use UTF-8python
with open('output.txt', 'w', encoding='utf-8') as f: f.write(chinese_content) -
Platform Compliance: Respect platform ToS. Use official APIs when available.
-
Graceful Degradation: Handle API failurespython
try: result = feishu_api.call() except Exception as e: logger.error(f"Feishu API failed: {e}") result = fallback_method() -
Prompt Engineering for Chinese: Use Chinese prompts for better results with Chinese LLMspython
# Good prompt = "请总结这篇文章的要点" # Less effective with Chinese LLMs prompt = "Please summarize the key points of this article"
-
安全性:永远不要硬编码凭据。使用环境变量或密钥管理工具。
-
中文文本编码:始终使用UTF-8python
with open('output.txt', 'w', encoding='utf-8') as f: f.write(chinese_content) -
平台合规:尊重平台服务条款。尽可能使用官方API。
-
优雅降级:处理API失败情况python
try: result = feishu_api.call() except Exception as e: logger.error(f"Feishu API调用失败: {e}") result = fallback_method() -
中文提示词工程:对中文LLM使用中文提示词以获得更好效果python
# 推荐 prompt = "请总结这篇文章的要点" # 对中文LLM效果较差 prompt = "Please summarize the key points of this article"
Contributing
贡献指南
See CONTRIBUTING.md for guidelines. All use cases should follow the template format and include working code examples.
请查看CONTRIBUTING.md了解贡献规则。所有用例需遵循模板格式并包含可运行的代码示例。