在阿里云上部署 OpenClaw 完整指南
Complete Guide to Deploying OpenClaw on Alibaba Cloud
覆盖阿里云百炼模型配置、飞书 / 钉钉(传统机器人 + DEAP 高级方案)/ QQ / Discord 全平台接入、Qoder CLI 集成,以及高级配置与运维。
Covers Alibaba Cloud Bailian model configuration, full-platform access for Feishu / DingTalk (traditional bot + DEAP advanced solution) / QQ / Discord, Qoder CLI integration, as well as advanced configuration and O&M.
⚠️ 安全警告
⚠️ Security Warning
在开始之前,请务必阅读以下注意事项:
- 切勿在个人主力电脑上部署 OpenClaw——它具有高文件系统和命令执行权限
- 务必使用云服务器(如阿里云 ECS)进行部署,与本地环境隔离
- 保护好你的 API 密钥——使用环境变量或安全保险箱,不要硬编码在代码中
- 使用强随机令牌限制 Gateway 访问,避免使用简单密码
- 定期轮换凭证——特别是钉钉/飞书/QQ 等平台的应用密钥
Before you start, please read the following precautions carefully:
- Never deploy OpenClaw on your primary personal computer - it has high file system and command execution permissions
- Be sure to use a cloud server (such as Alibaba Cloud ECS) for deployment to isolate it from your local environment
- Protect your API keys properly - use environment variables or secret vaults, do not hardcode them in code
- Use strong random tokens to restrict Gateway access, avoid using simple passwords
- Rotate credentials regularly - especially application keys for platforms such as DingTalk/Feishu/QQ
- 在阿里云 ECS 服务器上从零部署 OpenClaw AI 助手
- 通过钉钉(Stream 机器人或 DEAP 高级方案)与 AI 对话
- 通过飞书、QQ 或 Discord 接入 OpenClaw
- 配置阿里云百炼 Coding Plan 作为 AI 推理后端
- 将 Qoder CLI 注册为 ACP Agent,实现钉钉/飞书中的代码开发
- Deploy OpenClaw AI assistant from scratch on Alibaba Cloud ECS server
- Talk to AI through DingTalk (Stream bot or DEAP advanced solution)
- Access OpenClaw through Feishu, QQ or Discord
- Configure Alibaba Cloud Bailian Coding Plan as the AI inference backend
- Register Qoder CLI as ACP Agent to implement code development in DingTalk/Feishu
安装 OpenClaw
Install OpenClaw
openclaw gateway --port 18789 --verbose
openclaw gateway --port 18789 --verbose
交互式配置模型和渠道
Interactive configuration of models and channels
查看所有渠道状态
View all channel status
查看实时日志
View real-time logs
tail -f /tmp/openclaw-gateway.log
tail -f /tmp/openclaw-gateway.log
- 切勿在本地主力电脑部署,务必使用云服务器(如阿里云 ECS)
- 钉钉应用必须完成「版本发布」流程,仅保存配置不生效
- 钉钉 Client Secret、百炼 API Key、QQ 机器人密钥均只显示一次,需立即保存
- 飞书集成需选择「WebSocket 长连接」模式,不要使用 HTTP 回调
- 钉钉 DEAP 方案需在同一服务器运行 Connector,确保 18789 端口本地可访问
- 建议为 Gateway 配置随机强令牌认证()
- Never deploy on your primary local computer, be sure to use a cloud server (such as Alibaba Cloud ECS)
- DingTalk applications must complete the "version release" process, saving configuration only will not take effect
- DingTalk Client Secret, Bailian API Key, QQ bot key are only displayed once, please save them immediately
- Feishu integration requires the "WebSocket persistent connection" mode, do not use HTTP callbacks
- DingTalk DEAP solution requires running Connector on the same server, ensure port 18789 is locally accessible
- It is recommended to configure random strong token authentication for Gateway ()
本指南将带你完成一套完整的 OpenClaw 云端部署,实现通过多种 IM 平台与 AI 助手对话,并可选接入 Qoder CLI 进行代码开发。
整体架构:
┌────────────────────────────────────────────────────────────┐
│ 用户层 │
│ ┌────────┐ ┌────────┐ ┌──────┐ ┌─────────┐ │
│ │ 飞书 │ │ 钉钉 │ │ QQ │ │ Discord │ │
│ └───┬────┘ └───┬────┘ └──┬───┘ └────┬────┘ │
└──────┼───────────┼──────────┼───────────┼─────────────────┘
│ │ │ │
└───────────┴──────────┴───────────┘
│
Stream / WebSocket
│
┌─────────────────────────────▼──────────────────────────────┐
│ OpenClaw Gateway :18789 │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ ACP 协议层 │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ acpx │ │ 调度器 │ │ 会话管理 │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ 渠道连接器层(飞书 / 钉钉 / QQ / Discord) │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
阿里云百炼 API / Qoder CLI
部署步骤总览:
- 购买并配置阿里云 ECS 服务器
- 安装 Node.js 与 OpenClaw
- 配置阿里云百炼模型(Coding Plan)
- 配置 Gateway 外部访问与认证
- 配置 ACP 协议支持
- 安装并配置 Qoder CLI(可选)
- 接入 IM 平台(飞书 / 钉钉 / QQ / Discord)
This guide will walk you through a complete cloud deployment of OpenClaw, enabling conversations with the AI assistant through multiple IM platforms, and optional access to Qoder CLI for code development.
Overall Architecture:
┌────────────────────────────────────────────────────────────┐
│ User Layer │
│ ┌────────┐ ┌────────┐ ┌──────┐ ┌─────────┐ │
│ │ Feishu │ │DingTalk│ │ QQ │ │ Discord │ │
│ └───┬────┘ └───┬────┘ └──┬───┘ └────┬────┘ │
└──────┼───────────┼──────────┼───────────┼─────────────────┘
│ │ │ │
└───────────┴──────────┴───────────┘
│
Stream / WebSocket
│
┌─────────────────────────────▼──────────────────────────────┐
│ OpenClaw Gateway :18789 │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ ACP Protocol Layer │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ acpx │ │ Scheduler│ │Session Mgmt│ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Channel Connector Layer (Feishu / DingTalk / QQ / Discord) │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
Alibaba Cloud Bailian API / Qoder CLI
Deployment Steps Overview:
- Purchase and configure Alibaba Cloud ECS server
- Install Node.js and OpenClaw
- Configure Alibaba Cloud Bailian model (Coding Plan)
- Configure Gateway external access and authentication
- Configure ACP protocol support
- Install and configure Qoder CLI (optional)
- Access IM platforms (Feishu / DingTalk / QQ / Discord)
必需账号和权限
Required Accounts and Permissions
- 阿里云账号
- 阿里云百炼账号(用于模型 API)
- 目标 IM 平台的开发者/管理员账号
- Alibaba Cloud account
- Alibaba Cloud Bailian account (for model API)
- Developer/Administrator account for the target IM platform
必需软件(本地)
Required Software (Local)
- SSH 客户端
- 现代浏览器(用于访问各平台开发者控制台)
- SSH client
- Modern browser (for accessing each platform's developer console)
第一阶段:阿里云服务器购买与配置
Phase 1: Alibaba Cloud Server Purchase and Configuration
1.1 推荐服务器配置
1.1 Recommended Server Configuration
| 配置项 | 最低要求 | 推荐配置 |
|---|
| CPU | 2 核 | 2 核 |
| 内存 | 2 GiB | 4 GiB |
| 磁盘 | 20 GB SSD | 40 GB ESSD |
| 带宽 | 1 Mbps | 20 Mbps+ |
| 操作系统 | Ubuntu 22.04 / CentOS 8 | Alibaba Cloud Linux 3 |
| 地域 | 任意 | 美国弗吉尼亚 / 中国香港(访问 AI 服务延迟低) |
| Configuration Item | Minimum Requirement | Recommended Configuration |
|---|
| CPU | 2 vCPU | 2 vCPU |
| Memory | 2 GiB | 4 GiB |
| Disk | 20 GB SSD | 40 GB ESSD |
| Bandwidth | 1 Mbps | 20 Mbps+ |
| Operating System | Ubuntu 22.04 / CentOS 8 | Alibaba Cloud Linux 3 |
| Region | Any | Northern Virginia, USA / Hong Kong, China (low latency for accessing AI services) |
1.2 购买方式
1.2 Purchase Method
方式一:通过计算巢快速部署(推荐新手)
访问阿里云计算巢,一键部署预配置环境:
按页面指引:选择地域 → 选择实例规格 → 配置网络和安全组 → 确认创建。
方式二:手动购买 ECS 实例
- 访问 阿里云 ECS 控制台
- 点击「创建实例」
- 关键选项:
- 镜像:Alibaba Cloud Linux 3 / Ubuntu 22.04(如有 OpenClaw 应用镜像可直接选用)
- 实例规格:(2 核 4 GiB)或更高
- 系统盘:40 GB ESSD
- 公网 IP:分配公网 IPv4
- 带宽:按使用流量或按固定带宽(至少 1 Mbps)
- 配置安全组(见下方)
- 设置登录凭证(密钥对推荐)
- 确认并创建
Method 1: Quick deployment via Compute Nest (recommended for beginners)
Visit Alibaba Cloud Compute Nest to deploy the pre-configured environment with one click:
Follow the page guide: Select region → Select instance specification → Configure network and security group → Confirm creation.
Method 2: Manually purchase ECS instance
- Visit Alibaba Cloud ECS Console
- Click "Create Instance"
- Key options:
- Image: Alibaba Cloud Linux 3 / Ubuntu 22.04 (you can directly select the OpenClaw application image if available)
- Instance specification: (2 vCPU 4 GiB) or higher
- System disk: 40 GB ESSD
- Public IP: Allocate public IPv4
- Bandwidth: Pay-by-traffic or fixed bandwidth (at least 1 Mbps)
- Configure security group (see below)
- Set login credentials (key pair is recommended)
- Confirm and create
1.3 配置安全组规则
1.3 Configure Security Group Rules
| 端口 | 协议 | 用途 | 授权对象 |
|---|
| 22 | TCP | SSH 远程连接 | 你的 IP 地址 |
| 18789 | TCP | OpenClaw Gateway | 0.0.0.0/0 |
配置步骤:
- ECS 控制台 → 找到实例 → 点击「安全组」
- 「配置规则」→「入方向」→「手动添加」以上规则
| Port | Protocol | Purpose | Authorization Object |
|---|
| 22 | TCP | SSH remote connection | Your IP address |
| 18789 | TCP | OpenClaw Gateway | 0.0.0.0/0 |
Configuration Steps:
- ECS Console → Find the instance → Click "Security Group"
- "Configure Rules" → "Inbound Direction" → "Add Manually" the above rules
1.4 连接到服务器
1.4 Connect to the Server
使用密码登录
Login with password
ssh root@<your server public IP>
ssh -i /path/to/your-key.pem root@<你的服务器公网IP>
ssh -i /path/to/your-key.pem root@<your server public IP>
或通过阿里云控制台网页终端:
Or via Alibaba Cloud Console web terminal:
ECS 控制台 → 实例详情 → 远程连接
ECS Console → Instance Details → Remote Connection
第二阶段:安装 Node.js 与 OpenClaw
Phase 2: Install Node.js and OpenClaw
2.1 安装 Node.js(推荐 nvm)
2.1 Install Node.js (nvm recommended)
安装 Node.js 22 LTS
Install Node.js 22 LTS
nvm install 22
nvm use 22
node -v # 验证:应输出 v22.x.x
nvm install 22
nvm use 22
node -v # Verification: should output v22.x.x
2.2 安装 OpenClaw
2.2 Install OpenClaw
方式一:通过官方安装脚本(推荐)
bash
curl -fsSL https://clawd.bot/install.sh | bash
方式二:通过 npm 全局安装
bash
npm install -g openclaw
验证安装:
Method 1: Via official installation script (recommended)
bash
curl -fsSL https://clawd.bot/install.sh | bash
Method 2: Global installation via npm
bash
npm install -g openclaw
Verify installation:
预期输出:版本号如 "2026.1.x"
Expected output: version number such as "2026.1.x"
若提示命令不存在,尝试旧名称:clawdbot --version
If the command is not found, try the old name: clawdbot --version
2.3 启动 OpenClaw Gateway
2.3 Start OpenClaw Gateway
方式一:前台启动(调试用)
Method 1: Start in foreground (for debugging)
openclaw gateway --port 18789 --verbose
openclaw gateway --port 18789 --verbose
方式二:后台启动
Method 2: Start in background
nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
systemctl --user status openclaw-gateway.service
systemctl --user status openclaw-gateway.service
第三阶段:配置阿里云百炼模型(Coding Plan)
Phase 3: Configure Alibaba Cloud Bailian Model (Coding Plan)
3.1 购买 Coding Plan 套餐
3.1 Purchase Coding Plan Package
| 套餐 | 首月价格 | 次月价格 | 每月请求量 |
|---|
| Lite 基础版 | 7.9 元 | 40 元/月 | 18,000 次 |
| Pro 高级版 | 39.9 元 | 200 元/月 | 90,000 次 |
- 访问 阿里云百炼控制台
- 导航至「Coding Plan」或「订阅套餐」
- 选择 Lite 或 Pro 完成支付
| Package | First Month Price | Subsequent Monthly Price | Monthly Requests |
|---|
| Lite Basic Version | ¥7.9 | ¥40/month | 18,000 times |
| Pro Advanced Version | ¥39.9 | ¥200/month | 90,000 times |
- Visit Alibaba Cloud Bailian Console
- Navigate to "Coding Plan" or "Subscription Packages"
- Select Lite or Pro to complete payment
3.2 获取 API 凭证
3.2 Obtain API Credentials
- Base URL(固定):
https://coding.dashscope.aliyuncs.com/v1
- API Key 格式:
获取步骤:
- 登录 阿里云百炼控制台
- 进入「密钥管理」或「API Keys」
- 点击「创建 API Key」
- 立即复制并保存——关闭后无法再次查看
支持的模型:
- - 通用场景(推荐入门)
- - 高级推理
- - 代码生成(如可用)
- - 中文优化
- Base URL (fixed):
https://coding.dashscope.aliyuncs.com/v1
- API Key Format:
Obtainment Steps:
- Log in to Alibaba Cloud Bailian Console
- Go to "Key Management" or "API Keys"
- Click "Create API Key"
- Copy and save immediately - you cannot view it again after closing the page
Supported Models:
- - General scenarios (recommended for beginners)
- - Advanced reasoning
- - Code generation (if available)
- - Chinese optimized
3.3 配置 OpenClaw 使用百炼
3.3 Configure OpenClaw to Use Bailian
方式一:交互式引导
按提示操作:
- 选择「添加自定义模型供应商」
- 供应商 ID:
- Base URL:
https://coding.dashscope.aliyuncs.com/v1
- API Key:粘贴
- API 类型:
- 添加模型:
- 设为默认模型
方式二:手动编辑配置文件
编辑
~/.openclaw/openclaw.json
:
json
{
"models": {
"providers": {
"bailian": {
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"apiKey": "sk-sp-YOUR_KEY_HERE",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus",
"name": "Qwen 3.5 Plus",
"reasoning": true,
"input": ["text"],
"contextWindow": 32000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "bailian/qwen3.5-plus"
}
}
}
}
Method 1: Interactive Guide
Follow the prompts:
- Select "Add custom model provider"
- Provider ID:
- Base URL:
https://coding.dashscope.aliyuncs.com/v1
- API Key: Paste
- API Type:
- Add model:
- Set as default model
Method 2: Manually edit configuration file
Edit
~/.openclaw/openclaw.json
:
json
{
"models": {
"providers": {
"bailian": {
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"apiKey": "sk-sp-YOUR_KEY_HERE",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus",
"name": "Qwen 3.5 Plus",
"reasoning": true,
"input": ["text"],
"contextWindow": 32000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "bailian/qwen3.5-plus"
}
}
}
}
第四阶段:配置 Gateway 外部访问与认证
Phase 4: Configure Gateway External Access and Authentication
当需要通过钉钉 DEAP 或其他外部服务访问 Gateway 时,需配置认证和 HTTP 端点。
When you need to access the Gateway through DingTalk DEAP or other external services, you need to configure authentication and HTTP endpoints.
4.1 生成强认证令牌
4.1 Generate Strong Authentication Token
示例输出:a3f7c2e1d4b5a6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3
Example output: a3f7c2e1d4b5a6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3
4.2 更新 Gateway 配置
4.2 Update Gateway Configuration
编辑
~/.openclaw/openclaw.json
,添加
部分:
json
{
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"controlUI": {
"allowInsecureAuth": false
},
"auth": {
"mode": "token",
"token": "在此处填入上一步生成的强令牌"
},
"http": {
"endpoints": {
"chatCompletions": {
"enabled": true
}
}
}
}
}
Edit
~/.openclaw/openclaw.json
, add the
section:
json
{
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"controlUI": {
"allowInsecureAuth": false
},
"auth": {
"mode": "token",
"token": "Fill in the strong token generated in the previous step here"
},
"http": {
"endpoints": {
"chatCompletions": {
"enabled": true
}
}
}
}
}
4.3 重启 Gateway
4.3 Restart Gateway
bash
openclaw gateway restart
bash
openclaw gateway restart
pkill -f "openclaw gateway"
nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
pkill -f "openclaw gateway"
nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
4.4 验证 Gateway 正常运行
4.4 Verify Gateway is Running Properly
bash
curl http://127.0.0.1:18789/health
bash
curl http://127.0.0.1:18789/health
应返回 {"status":"ok"} 或类似响应
Should return {"status":"ok"} or similar response
第五阶段:配置 ACP 协议支持
Phase 5: Configure ACP Protocol Support
ACP(Agent Client Protocol)协议允许 OpenClaw 调度多种 AI Agent。
ACP (Agent Client Protocol) allows OpenClaw to schedule multiple AI Agents.
5.1 安装并启用 ACPX 插件
5.1 Install and Enable ACPX Plugin
安装 ACPX 插件
Install ACPX plugin
openclaw plugins install @openclaw/acpx
openclaw plugins install @openclaw/acpx
openclaw config set plugins.entries.acpx.enabled true
openclaw config set plugins.entries.acpx.enabled true
5.2 配置 ACP 参数
5.2 Configure ACP Parameters
openclaw config set acp.enabled true
openclaw config set acp.enabled true
启用 ACP 调度
Enable ACP dispatch
openclaw config set acp.dispatch.enabled true
openclaw config set acp.dispatch.enabled true
设置后端为 acpx
Set backend to acpx
openclaw config set acp.backend "acpx"
openclaw config set acp.backend "acpx"
设置默认 Agent
Set default Agent
openclaw config set acp.defaultAgent "openclaw"
openclaw config set acp.defaultAgent "openclaw"
设置允许的 Agents
Set allowed Agents
openclaw config set acp.allowedAgents '["openclaw","claude","codex","opencode","gemini"]'
openclaw config set acp.allowedAgents '["openclaw","claude","codex","opencode","gemini"]'
设置最大并发会话数
Set maximum concurrent sessions
openclaw config set acp.maxConcurrentSessions 8
openclaw config set acp.maxConcurrentSessions 8
5.3 重启 Gateway 使配置生效
5.3 Restart Gateway for Configuration to Take Effect
bash
openclaw gateway restart
bash
openclaw gateway restart
5.4 验证 ACP 配置
5.4 Verify ACP Configuration
bash
openclaw config get acp --raw
bash
openclaw config get acp --raw
"enabled": true,
"enabled": true,
"dispatch": { "enabled": true },
"dispatch": { "enabled": true },
"backend": "acpx",
"backend": "acpx",
"defaultAgent": "openclaw",
"defaultAgent": "openclaw",
"allowedAgents": [...]
"allowedAgents": [...]
第六阶段:安装并配置 Qoder CLI(可选)
Phase 6: Install and Configure Qoder CLI (Optional)
如果你希望通过 Qoder 进行代码开发,可安装 Qoder CLI 并将其注册为 ACP Agent。
If you want to develop code through Qoder, you can install Qoder CLI and register it as an ACP Agent.
6.1 安装 Qoder CLI
6.1 Install Qoder CLI
bash
npm install -g @qoder-ai/qodercli
bash
npm install -g @qoder-ai/qodercli
6.2 配置 Qoder CLI 认证
6.2 Configure Qoder CLI Authentication
方式一:环境变量(临时)
bash
export QODER_PERSONAL_ACCESS_TOKEN="your-api-key-here"
qodercli status # 验证登录
方式二:持久化配置文件
bash
mkdir -p ~/.config/qoder
cat > ~/.config/qoder/config.json << 'EOF'
{
"api_key": "your-api-key-here"
}
EOF
Method 1: Environment variable (temporary)
bash
export QODER_PERSONAL_ACCESS_TOKEN="your-api-key-here"
qodercli status # Verify login
Method 2: Persistent configuration file
bash
mkdir -p ~/.config/qoder
cat > ~/.config/qoder/config.json << 'EOF'
{
"api_key": "your-api-key-here"
}
EOF
6.3 配置 acpx 支持 Qoder
6.3 Configure acpx to Support Qoder
bash
mkdir -p ~/.acpx
cat > ~/.acpx/config.json << 'EOF'
{
"agents": {
"qoder": {
"command": "env QODER_PERSONAL_ACCESS_TOKEN=your-api-key-here qodercli --acp"
}
},
"defaultAgent": "qoder",
"defaultPermissions": "approve-all"
}
EOF
bash
mkdir -p ~/.acpx
cat > ~/.acpx/config.json << 'EOF'
{
"agents": {
"qoder": {
"command": "env QODER_PERSONAL_ACCESS_TOKEN=your-api-key-here qodercli --acp"
}
},
"defaultAgent": "qoder",
"defaultPermissions": "approve-all"
}
EOF
6.4 将 Qoder 注册到 ACP
6.4 Register Qoder to ACP
添加 qoder 到允许的 Agents 列表
Add qoder to allowed Agents list
openclaw config set acp.allowedAgents '["openclaw","qoder","claude","codex","opencode","gemini"]'
openclaw config set acp.allowedAgents '["openclaw","qoder","claude","codex","opencode","gemini"]'
可选:设置 qoder 为默认 Agent
Optional: Set qoder as default Agent
openclaw config set acp.defaultAgent "qoder"
openclaw config set acp.defaultAgent "qoder"
重启 Gateway
Restart Gateway
6.5 测试 Qoder CLI
6.5 Test Qoder CLI
bash
qodercli -p "hello" --max-turns 1
bash
qodercli -p "hello" --max-turns 1
若返回结果,说明 Qoder CLI 工作正常
If a result is returned, Qoder CLI is working properly
第七阶段:飞书 Bot 集成
Phase 7: Feishu Bot Integration
7.1 创建飞书企业自建应用
7.1 Create Feishu Enterprise Self-built Application
- 访问 飞书开放平台
- 点击「创建应用」→ 选择「企业自建」
- 填写应用名称(如「OpenClaw 助手」)和描述
- 立即记录 App ID 和 App Secret
- Visit Feishu Open Platform
- Click "Create Application" → Select "Enterprise Self-built"
- Fill in the application name (such as "OpenClaw Assistant") and description
- Record App ID and App Secret immediately
7.2 配置必需权限
7.2 Configure Required Permissions
进入应用「权限管理」,开启以下权限:
contact:user.base:readonly 获取用户基本信息
im:message 读取消息
im:message:send_as_bot 发送消息(Bot 身份)
im:resource 获取消息中的资源
确认 4 个权限全部激活。
Go to the application "Permission Management" and enable the following permissions:
contact:user.base:readonly Get basic user information
im:message Read messages
im:message:send_as_bot Send messages (as Bot)
im:resource Get resources in messages
Confirm all 4 permissions are activated.
7.3 启用机器人并配置事件订阅
7.3 Enable Bot and Configure Event Subscription
- 进入「应用能力」→ 添加「机器人」
- 事件订阅:选择「使用长连接接收事件」(WebSocket,无需公网 URL)
- 添加事件:(接收消息事件)
- 保存并创建版本
- 发布应用(企业内部审批即可)
- Go to "Application Capabilities" → Add "Robot"
- Event subscription: Select "Use persistent connection to receive events" (WebSocket, no public URL required)
- Add event: (message receiving event)
- Save and create a version
- Publish the application (only internal enterprise approval required)
7.4 配置 OpenClaw 接入飞书
7.4 Configure OpenClaw to Access Feishu
运行引导:
按提示操作:
- 接受风险:是
- 配置方式:快速开始
- 模型供应商:选择已配置的百炼
- 通道:选择飞书
- 输入凭证:App ID、App Secret(来自步骤 7.1)
- 启用技能:是
- 选择钩子:session-memory
- 重启 Gateway:是
Run the guide:
Follow the prompts:
- Accept risk: Yes
- Configuration method: Quick Start
- Model provider: Select the configured Bailian
- Channel: Select Feishu
- Enter credentials: App ID, App Secret (from step 7.1)
- Enable skills: Yes
- Select hook: session-memory
- Restart Gateway: Yes
7.5 使用飞书机器人
7.5 Use Feishu Bot
- 工作台:飞书 → 工作台 → 找到应用 → 开始聊天
- 全局搜索:搜索应用名称直接进入
- 群聊:将机器人加入群组 → @提及机器人交互
- Workbench: Feishu → Workbench → Find the application → Start chatting
- Global Search: Search for the application name to enter directly
- Group Chat: Add the bot to the group → @mention the bot to interact
第八阶段:钉钉集成
Phase 8: DingTalk Integration
钉钉提供两种接入方案,根据需求选择:
| 方案 | 复杂度 | 特点 |
|---|
| 方案 A:传统机器人(Stream 模式) | 较低 | 直接配置,无需额外组件 |
| 方案 B:DEAP Agent(高级) | 较高 | 通过 Connector 隧道,功能更丰富 |
DingTalk provides two access solutions, choose according to your needs:
| Solution | Complexity | Features |
|---|
| Solution A: Traditional Bot (Stream Mode) | Low | Direct configuration, no additional components required |
| Solution B: DEAP Agent (Advanced) | High | Richer functions through Connector tunnel |
方案 A:钉钉机器人(Stream 模式)
Solution A: DingTalk Bot (Stream Mode)
A-1:安装钉钉插件
A-1: Install DingTalk Plugin
bash
openclaw plugins install https://github.com/soimy/openclaw-channel-dingtalk.git
bash
openclaw plugins install https://github.com/soimy/openclaw-channel-dingtalk.git
A-2:在钉钉开放平台创建企业内部应用
A-2: Create Enterprise Internal Application on DingTalk Open Platform
- 访问 钉钉开放平台
- 使用企业管理员账号登录
- 点击「创建应用」→ 选择「企业内部应用」
- 填写应用信息(名称、描述、图标)
- 点击「确定创建」
- 在「凭证与基础信息」中记录 Client ID(AppKey)和 Client Secret(AppSecret)
⚠️ Client Secret 只显示一次,请立即妥善保存。
- Visit DingTalk Open Platform
- Log in with enterprise administrator account
- Click "Create Application" → Select "Enterprise Internal Application"
- Fill in application information (name, description, icon)
- Click "Confirm Creation"
- Record Client ID (AppKey) and Client Secret (AppSecret) in "Credentials and Basic Information"
⚠️ Client Secret is only displayed once, please save it properly immediately.
A-3:配置应用权限
A-3: Configure Application Permissions
进入「权限管理」,申请以下权限:
通讯录权限:
- - 获取企业成员信息
qyapi_get_department_list
- 获取部门列表
机器人权限:
点击「批量申请」,等待管理员审批通过。
Go to "Permission Management" and apply for the following permissions:
Address Book Permissions:
- - Get enterprise member information
qyapi_get_department_list
- Get department list
Bot Permissions:
Click "Batch Apply" and wait for administrator approval.
A-4:配置并发布机器人
A-4: Configure and Publish Bot
- 进入「机器人」页面 → 添加机器人 → 选择「自定义机器人」
- 消息接收模式:Stream 模式(WebSocket,无需公网 IP)
- 进入「版本管理与发布」→ 创建新版本(1.0.0)→ 申请发布
- Go to "Robot" page → Add Robot → Select "Custom Robot"
- Message receiving mode: Stream Mode (WebSocket, no public IP required)
- Go to "Version Management and Release" → Create new version (1.0.0) → Apply for release
A-5:配置 OpenClaw 连接钉钉
A-5: Configure OpenClaw to Connect to DingTalk
编辑
~/.openclaw/openclaw.json
,在
中添加:
json
{
"channels": {
"dingtalk": {
"enabled": true,
"clientId": "你的_APPKEY",
"clientSecret": "你的_APPSECRET",
"robotCode": "你的_APPKEY",
"corpId": "你的_CORPID",
"agentId": "你的_AGENTID",
"dmPolicy": "open",
"groupPolicy": "open",
"messageType": "markdown",
"streamMode": true,
"autoReply": true,
"debug": false
}
}
}
或使用命令行配置:
bash
openclaw config set channels.dingtalk.enabled true
openclaw config set channels.dingtalk.clientId "YOUR_CLIENT_ID"
openclaw config set channels.dingtalk.clientSecret "YOUR_CLIENT_SECRET"
openclaw config set channels.dingtalk.sessionTimeout 1800000
openclaw gateway restart
Edit
~/.openclaw/openclaw.json
, add in
:
json
{
"channels": {
"dingtalk": {
"enabled": true,
"clientId": "YOUR_APPKEY",
"clientSecret": "YOUR_APPSECRET",
"robotCode": "YOUR_APPKEY",
"corpId": "YOUR_CORPID",
"agentId": "YOUR_AGENTID",
"dmPolicy": "open",
"groupPolicy": "open",
"messageType": "markdown",
"streamMode": true,
"autoReply": true,
"debug": false
}
}
}
Or use command line configuration:
bash
openclaw config set channels.dingtalk.enabled true
openclaw config set channels.dingtalk.clientId "YOUR_CLIENT_ID"
openclaw config set channels.dingtalk.clientSecret "YOUR_CLIENT_SECRET"
openclaw config set channels.dingtalk.sessionTimeout 1800000
openclaw gateway restart
A-6:将机器人添加到群聊
A-6: Add Bot to Group Chat
- 打开目标钉钉群 → 群设置 → 智能群助手
- 添加机器人 → 企业内部机器人 → 找到你的机器人 → 添加
- Open the target DingTalk group → Group Settings → Smart Group Assistant
- Add Robot → Enterprise Internal Robot → Find your robot → Add
Verification: Send
@OpenClaw Assistant Hello
in the group chat, the bot should reply.
方案 B:钉钉 DEAP Agent(高级方案)
Solution B: DingTalk DEAP Agent (Advanced Solution)
架构: 钉钉 App → DEAP 云端 → Connector 隧道 → 你的服务器 Gateway
Architecture: DingTalk App → DEAP Cloud → Connector Tunnel → Your Server Gateway
B-1:获取 DEAP 凭证
B-1: Obtain DEAP Credentials
B-2:在服务器上安装并运行 Connector
B-2: Install and Run Connector on Server
检查服务器架构
Check server architecture
uname -m # x86_64 或 aarch64
uname -m # x86_64 or aarch64
从以下地址下载对应版本:
Download the corresponding version from:
cd ~
wget [下载链接] -O connector.zip
unzip -o connector.zip
cd connector-linux-amd64 # 根据实际目录名调整
chmod +x connector-linux
cd ~
wget [download link] -O connector.zip
unzip -o connector.zip
cd connector-linux-amd64 # Adjust according to actual directory name
chmod +x connector-linux
后台运行 Connector
Run Connector in background
nohup ./connector-linux
-deapCorpId 你的_CORPID
-deapApiKey 你的_DEAP_APIKEY \
/tmp/dingtalk-connector.log 2>&1 &
nohup ./connector-linux
-deapCorpId YOUR_CORPID
-deapApiKey YOUR_DEAP_APIKEY \
/tmp/dingtalk-connector.log 2>&1 &
验证运行状态
Verify running status
ps aux | grep connector
tail -20 /tmp/dingtalk-connector.log
ps aux | grep connector
tail -20 /tmp/dingtalk-connector.log
B-3:在 DEAP 平台创建 Agent
B-3: Create Agent on DEAP Platform
- 访问 钉钉 DEAP 平台
- 创建新 Agent
- 添加技能:搜索「OpenClaw」或「OpenClaw Gateway」
- 配置技能参数:
- apikey:你的 DEAP API Key
- apihost:
- gatewayToken:第四阶段配置的 Gateway 认证令牌
- 发布 Agent
- Visit DingTalk DEAP Platform
- Create new Agent
- Add skill: Search for "OpenClaw" or "OpenClaw Gateway"
- Configure skill parameters:
- apikey: Your DEAP API Key
- apihost:
- gatewayToken: Gateway authentication token configured in Phase 4
- Publish Agent
B-4:在钉钉中使用 DEAP Agent
B-4: Use DEAP Agent in DingTalk
- 在钉钉 App 中搜索 Agent 名称
- 直接用自然语言发送任务,命令通过隧道在阿里云服务器上执行
- Search for the Agent name in DingTalk App
- Send tasks directly in natural language, commands are executed on Alibaba Cloud server through the tunnel
第九阶段:QQ Bot 集成
Phase 9: QQ Bot Integration
9.1 创建 QQ 机器人
9.1 Create QQ Bot
- 访问 QQ 开放平台
- 重要:需注册账号(非 QQ 账号直接登录)
- 登录 → 「机器人」→「创建机器人」
- 填写名称和描述
- 立即记录机器人 ID 和机器人密钥(关闭后无法再次查看)
- Visit QQ Open Platform
- Important: You need to register an account (cannot log in directly with QQ account)
- Log in → "Robot" → "Create Robot"
- Fill in name and description
- Record robot ID and robot secret immediately (cannot be viewed again after closing the page)
9.2 配置 IP 白名单
9.2 Configure IP Whitelist
- QQ 开放平台 → 机器人详情 → IP 白名单
- 将阿里云服务器的公网 IP 加入白名单
- QQ Open Platform → Bot Details → IP Whitelist
- Add the public IP of your Alibaba Cloud server to the whitelist
9.3 配置 OpenClaw
9.3 Configure OpenClaw
选择 QQ 作为通道,输入:
完成剩余步骤(模型选择、技能、钩子)。
Select QQ as the channel, enter:
Complete the remaining steps (model selection, skills, hooks).
第十阶段:Discord Bot 集成
Phase 10: Discord Bot Integration
10.1 创建 Discord Bot
10.1 Create Discord Bot
- 访问 Discord Developer Portal
- 「New Application」→ 输入应用名称
- 进入「Bot」标签页
- 点击「Reset Token」→ 立即复制并保存 Bot Token
- 开启「Message Content Intent」(消息内容意图权限)
- Visit Discord Developer Portal
- "New Application" → Enter application name
- Go to "Bot" tab
- Click "Reset Token" → Copy and save Bot Token immediately
- Enable "Message Content Intent" (message content intent permission)
10.2 生成邀请链接并加入服务器
10.2 Generate Invite Link and Join Server
- 进入「OAuth2」→「URL Generator」
- Scope 选择:
- Bot Permissions 勾选:
- Send Messages
- Read Message History
- 复制生成的 URL,在浏览器中打开
- 选择你的 Discord 服务器 → 授权
- Go to "OAuth2" → "URL Generator"
- Scope select:
- Bot Permissions check:
- Send Messages
- Read Message History
- Copy the generated URL, open it in a browser
- Select your Discord server → Authorize
10.3 配置 OpenClaw
10.3 Configure OpenClaw
选择 Discord 作为通道,输入 Bot Token(来自步骤 10.1)。
Select Discord as the channel, enter Bot Token (from step 10.1).
Legacy Note: Some old documents use
, please use
uniformly.
验证与使用示例
Verification and Usage Examples
全平台通用测试消息
General Test Messages for All Platforms
你现在用的是什么模型?
用三句话总结什么是 OpenClaw
创建一个工作日报模板
What model are you using now?
Summarize what OpenClaw is in three sentences
Create a work daily report template
检查 Gateway 状态
Check Gateway Status
查看 Gateway 运行日志
View Gateway running logs
tail -50 /tmp/openclaw-gateway.log
tail -50 /tmp/openclaw-gateway.log
查看所有渠道状态
View all channel status
查看 ACP 会话
View ACP sessions
钉钉使用示例
DingTalk Usage Examples
@OpenClaw Assistant Hello, please introduce yourself
@OpenClaw 助手 帮我写一段 Python 爬虫代码,抓取网页标题
@OpenClaw Assistant Help me write a Python crawler code to grab web page titles
指定特定 Agent
Specify specific Agent
@OpenClaw 助手 /acp spawn claude 分析这段代码的 bug
@OpenClaw Assistant /acp spawn claude Analyze the bugs in this code
如果安装了 Qoder CLI
If Qoder CLI is installed
@OpenClaw 助手 用 qoder 开发一个 TODO 应用
@OpenClaw Assistant Use qoder to develop a TODO application
多轮对话
Multi-turn conversation
@OpenClaw 助手 我想开发一个个人博客(使用 Next.js 和 TypeScript)
@OpenClaw Assistant I want to develop a personal blog (using Next.js and TypeScript)
并行任务执行示例
Parallel Task Execution Example
一次发送多个任务以提升效率:
请处理以下任务:
1. 用三句话总结 OpenClaw
2. 创建一个包含 5 项的每周待办模板
3. 推荐一个提高效率的小技巧
Send multiple tasks at once to improve efficiency:
Please handle the following tasks:
1. Summarize OpenClaw in three sentences
2. Create a weekly to-do template with 5 items
3. Recommend a small tip to improve efficiency
高级配置
Advanced Configuration
配置多个 Agent
Configure Multiple Agents
设置允许的 Agents 列表
Set allowed Agents list
openclaw config set acp.allowedAgents '["openclaw","qoder","claude","codex","opencode","gemini"]'
openclaw config set acp.allowedAgents '["openclaw","qoder","claude","codex","opencode","gemini"]'
在聊天中使用特定 Agent
Use specific Agent in chat
/acp spawn codex --mode persistent 使用 Codex
/acp spawn codex --mode persistent Use Codex
/acp spawn claude --mode persistent 使用 Claude
/acp spawn claude --mode persistent Use Claude
/acp spawn qoder --mode persistent 使用 Qoder
/acp spawn qoder --mode persistent Use Qoder
配置持久化会话
Configure Persistent Sessions
启用会话绑定(同一话题持续使用同一 Agent)
Enable session binding (continue using the same Agent for the same topic)
openclaw config set session.threadBindings.enabled true
openclaw config set session.threadBindings.ttlHours 24
openclaw gateway restart
openclaw config set session.threadBindings.enabled true
openclaw config set session.threadBindings.ttlHours 24
openclaw gateway restart
配置安全策略
Configure Security Policy
设置执行权限级别
Set execution permission level
strict: 严格限制 moderate: 适度限制 approve-all: 全部批准
strict: Strict restriction moderate: Moderate restriction approve-all: Approve all
openclaw config set acp.permissions "strict"
openclaw config set acp.permissions "strict"
设置任务超时时间(秒)
Set task timeout (seconds)
openclaw config set acp.timeout 300
openclaw config set acp.timeout 300
配置消息回复模板
Configure Message Reply Template
新建
~/.openclaw/dingtalk-templates.json
:
json
{
"welcome": "你好!我是 OpenClaw AI 助手,有什么可以帮助你的吗?",
"error": "抱歉,处理您的请求时出现了错误,请稍后重试。",
"thinking": "正在思考中...",
"timeout": "处理超时,请简化您的问题后重试。"
}
Create
~/.openclaw/dingtalk-templates.json
:
json
{
"welcome": "Hello! I am OpenClaw AI Assistant, how can I help you?",
"error": "Sorry, an error occurred while processing your request, please try again later.",
"thinking": "Thinking...",
"timeout": "Processing timed out, please simplify your question and try again."
}
性能优化与运维
Performance Optimization and O&M
配置 systemd 系统服务(推荐生产环境)
Configure systemd System Service (Recommended for Production Environment)
增加系统文件描述符限制
Increase system file descriptor limit
echo "fs.file-max = 65535" >> /etc/sysctl.conf
sysctl -p
echo "fs.file-max = 65535" >> /etc/sysctl.conf
sysctl -p
创建 systemd 服务
Create systemd service
cat > /etc/systemd/system/openclaw.service << 'EOF'
[Unit]
Description=OpenClaw Gateway
After=network.target
[Service]
Type=simple
User=root
ExecStart=/root/.nvm/versions/node/v22.22.0/bin/openclaw gateway
Restart=always
RestartSec=5
Environment="PATH=/root/.nvm/versions/node/v22.22.0/bin:/usr/bin:/usr/local/bin"
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable openclaw
systemctl start openclaw
systemctl status openclaw
cat > /etc/systemd/system/openclaw.service << 'EOF'
[Unit]
Description=OpenClaw Gateway
After=network.target
[Service]
Type=simple
User=root
ExecStart=/root/.nvm/versions/node/v22.22.0/bin/openclaw gateway
Restart=always
RestartSec=5
Environment="PATH=/root/.nvm/versions/node/v22.22.0/bin:/usr/bin:/usr/local/bin"
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable openclaw
systemctl start openclaw
systemctl status openclaw
监控与日志管理
Monitoring and Log Management
实时查看 Gateway 日志
View Gateway logs in real time
tail -f /tmp/openclaw-gateway.log
tail -f /tmp/openclaw-gateway.log
查看钉钉渠道指标
View DingTalk channel metrics
openclaw channel metrics dingtalk
openclaw channel metrics dingtalk
通过 systemd 查看日志
View logs via systemd
journalctl -u openclaw -f
journalctl -u openclaw -f
钉钉 DEAP Connector 守护进程
DingTalk DEAP Connector Daemon
配置 Connector 开机自启
Configure Connector to start on boot
cat > /etc/systemd/system/dingtalk-connector.service << 'EOF'
[Unit]
Description=DingTalk DEAP Connector
After=network.target openclaw.service
[Service]
Type=simple
User=root
WorkingDirectory=/root/connector-linux-amd64
ExecStart=/root/connector-linux-amd64/connector-linux
-deapCorpId YOUR_CORPID
-deapApiKey YOUR_DEAP_APIKEY
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl enable dingtalk-connector
systemctl start dingtalk-connector
cat > /etc/systemd/system/dingtalk-connector.service << 'EOF'
[Unit]
Description=DingTalk DEAP Connector
After=network.target openclaw.service
[Service]
Type=simple
User=root
WorkingDirectory=/root/connector-linux-amd64
ExecStart=/root/connector-linux-amd64/connector-linux
-deapCorpId YOUR_CORPID
-deapApiKey YOUR_DEAP_APIKEY
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl enable dingtalk-connector
systemctl start dingtalk-connector
常见问题排查
Common Problem Troubleshooting
故障速查表
Troubleshooting Cheat Sheet
| 现象 | 可能原因 | 解决方案 |
|---|
| Gateway Token 不匹配 | 检查 中的 token 与 DEAP/机器人配置一致 |
| HTTP 端点未启用 | 确保 gateway.http.endpoints.chatCompletions.enabled: true
|
| 机器人完全无响应 | 应用未发布 / 权限缺失 | 检查应用发布状态和权限审批 |
| DEAP Connector 断开 | 防火墙 / 端口问题 | 确保 18789 端口本地可访问,检查防火墙规则 |
| 机器人回复慢 | 服务器资源不足 | 检查 CPU/内存,查看 ACP 会话数 |
| 钉钉权限未通过审批 | 重新申请权限并等待审批 |
| Phenomenon | Possible Cause | Solution |
|---|
| Gateway Token mismatch | Check that the token in is consistent with DEAP/bot configuration |
| HTTP endpoint not enabled | Ensure gateway.http.endpoints.chatCompletions.enabled: true
|
| Bot does not respond at all | Application not published / missing permissions | Check application publication status and permission approval |
| DEAP Connector disconnected | Firewall / port issue | Ensure port 18789 is locally accessible, check firewall rules |
| Bot replies slowly | Insufficient server resources | Check CPU/memory, view ACP session count |
| DingTalk permissions not approved | Reapply for permissions and wait for approval |
问题 1:Gateway 启动失败
Problem 1: Gateway Startup Failed
检查端口占用
Check port occupation
netstat -tlnp | grep 18789
netstat -tlnp | grep 18789
openclaw gateway restart --force
openclaw gateway restart --force
问题 2:钉钉机器人无响应
Problem 2: DingTalk Bot Does Not Respond
排查步骤:
- 确认应用已在「版本管理与发布」中正式发布(仅保存不够)
- 确认所有机器人权限已申请并审批通过
- 核对 Client ID 和 Client Secret 无误
- 查看连接器日志:
openclaw logs dingtalk -f
- 确认 Stream 模式已启用
- 确认机器人已添加到目标群聊
Troubleshooting Steps:
- Confirm the application has been officially published in "Version Management and Release" (saving only is not enough)
- Confirm all bot permissions have been applied for and approved
- Verify that Client ID and Client Secret are correct
- View connector logs:
openclaw logs dingtalk -f
- Confirm Stream mode is enabled
- Confirm the bot has been added to the target group chat
问题 3:无法将机器人添加到群聊
Problem 3: Cannot Add Bot to Group Chat
排查步骤:
- 确认你是群管理员或群主
- 确认应用已发布并通过管理员审批
- 在「机器人」页面确认机器人状态为「已启用」
Troubleshooting Steps:
- Confirm you are the group administrator or owner
- Confirm the application has been published and approved by the administrator
- Confirm the bot status is "Enabled" on the "Robot" page
问题 4:Stream 模式 / WebSocket 连接失败
Problem 4: Stream Mode / WebSocket Connection Failed
检查服务器是否能访问外部服务
Check if the server can access external services
ping oapi.dingtalk.com
ping open.feishu.cn
ping oapi.dingtalk.com
ping open.feishu.cn
检查防火墙是否阻止出站连接
Check if the firewall blocks outbound connections
尝试重启对应渠道连接器
Try restarting the corresponding channel connector
openclaw channel restart dingtalk
openclaw channel restart dingtalk
问题 5:机器人回复慢或中途超时
Problem 5: Bot Replies Slowly or Times Out Midway
检查服务器资源
Check server resources
查看 ACP 会话状态
View ACP session status
检查 OpenClaw 错误日志
Check OpenClaw error logs
快速参考卡
Quick Reference Card
| 平台 | 关键凭证 | 连接模式 | 特殊要求 |
|---|
| 飞书 | App ID、App Secret | WebSocket 长连接 | 4 个权限, 事件 |
| 钉钉(传统机器人) | AppKey、AppSecret、CorpId、AgentId | Stream 模式 | 、 权限 |
| 钉钉(DEAP) | CorpId、DEAP API Key、Gateway Token | Connector 隧道 | Connector 需与 Gateway 在同一服务器 |
| QQ | 机器人 ID、机器人密钥 | HTTP API | 服务器公网 IP 加入白名单 |
| Discord | Bot Token | WebSocket Gateway | 启用 Message Content Intent |
| Platform | Key Credentials | Connection Mode | Special Requirements |
|---|
| Feishu | App ID, App Secret | WebSocket persistent connection | 4 permissions, event |
| DingTalk (Traditional Bot) | AppKey, AppSecret, CorpId, AgentId | Stream Mode | , permissions |
| DingTalk (DEAP) | CorpId, DEAP API Key, Gateway Token | Connector tunnel | Connector must be on the same server as Gateway |
| QQ | Robot ID, Robot Secret | HTTP API | Server public IP added to whitelist |
| Discord | Bot Token | WebSocket Gateway | Enable Message Content Intent |
环境变量参考
Environment Variable Reference
Use environment variables instead of hardcoded tokens in configuration files (recommended):
添加到 ~/.bashrc 或 ~/.zshrc
Add to ~/.bashrc or ~/.zshrc
export OPENCLAW_GATEWAY_TOKEN="你的_gateway_token"
export DINGTALK_CLIENT_SECRET="你的_dingtalk_secret"
export FEISHU_APP_SECRET="你的_feishu_secret"
export BAILIAN_API_KEY="sk-sp-YOUR_KEY_HERE"
export QODER_PERSONAL_ACCESS_TOKEN="你的_qoder_api_key"
然后执行 `source ~/.bashrc` 使配置生效。部分 OpenClaw 版本支持在 `openclaw.json` 中使用 `$ENV_VAR` 语法引用环境变量。
---
export OPENCLAW_GATEWAY_TOKEN="your_gateway_token"
export DINGTALK_CLIENT_SECRET="your_dingtalk_secret"
export FEISHU_APP_SECRET="your_feishu_secret"
export BAILIAN_API_KEY="sk-sp-YOUR_KEY_HERE"
export QODER_PERSONAL_ACCESS_TOKEN="your_qoder_api_key"
Then execute `source ~/.bashrc` for the configuration to take effect. Some versions of OpenClaw support using `$ENV_VAR` syntax in `openclaw.json` to reference environment variables.
---
日常维护命令
Daily Maintenance Commands
重启 Gateway:
bash
systemctl restart openclaw
Restart Gateway:
bash
systemctl restart openclaw
pkill -f "openclaw gateway" && nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
**更新 OpenClaw:**
```bash
openclaw update
pkill -f "openclaw gateway" && nohup setsid openclaw gateway --port 18789 --verbose > /tmp/openclaw-gateway.log 2>&1 &
**Update OpenClaw:**
```bash
openclaw update
或重新运行安装脚本:
Or re-run the installation script:
**管理插件:**
```bash
openclaw plugins list
openclaw plugins update [插件名]
openclaw plugins install [插件名或 Git URL]
查看运行日志:
**Manage Plugins:**
```bash
openclaw plugins list
openclaw plugins update [plugin name]
openclaw plugins install [plugin name or Git URL]
View Running Logs:
Gateway 主日志
Gateway main log
tail -f /tmp/openclaw-gateway.log
tail -f /tmp/openclaw-gateway.log
钉钉 DEAP Connector 日志
DingTalk DEAP Connector log
tail -f /tmp/dingtalk-connector.log
tail -f /tmp/dingtalk-connector.log
特定渠道日志
Specific channel logs
openclaw logs dingtalk -f
openclaw logs feishu -f
**故障排查入口:**
```bash
openclaw gateway status # Gateway 状态
openclaw channel list # 所有渠道状态
openclaw sessions list # ACP 会话列表
openclaw channel status dingtalk # 特定渠道状态
openclaw logs dingtalk -f
openclaw logs feishu -f
**Troubleshooting Entry:**
```bash
openclaw gateway status # Gateway status
openclaw channel list # All channel status
openclaw sessions list # ACP session list
openclaw channel status dingtalk # Specific channel status