Skip to content
广告 · 本站推荐广告

openclaw webhooks

管理 Webhook。

概要

bash
openclaw webhooks <子命> [选项]

描述

openclaw webhooks 命令用于管理 OpenClaw 的 Webhook 端点。Webhook 允许外部系统通过 HTTP 请求触发 Agent 操作或接收事件通知。支持创建、测试、查看和删除 Webhook。

子命令

子命令说明
list列出所有 Webhook
create <name>创建新的 Webhook
delete <name>删除 Webhook
test <name>测试 Webhook 投递
logs <name>查看 Webhook 投递日志
inspect <name>查看 Webhook 配置详情

选项

选项缩写说明默认值
--url <url>Webhook 目标 URL-
--events <list>-e订阅的事件类型(逗号分隔)全部
--secret <key>Webhook 签名密钥自动生成
--format <type>输出格式:textjsontabletable
--active仅显示活跃的 Webhookfalse

事件类型

事件说明
message.received收到新消息
message.sent发送消息
session.created新会话创建
session.ended会话结束
skill.triggered技能触发
error.occurred发生错误
pairing.requested收到配对请求

载荷格式

Webhook 以 JSON 格式投递:

json
{
  "event": "message.received",
  "timestamp": "2026-03-05T10:30:00Z",
  "data": {
    "session_key": "whatsapp:+8613800001234",
    "message": "你好",
    "channel": "whatsapp"
  },
  "signature": "sha256=xxxxxxxx"
}

输出示例

$ openclaw webhooks list
┌──────────────┬──────────────────────────────┬──────────┬──────────┐
│ 名称          │ URL                          │ 事件     │ 状态     │
├──────────────┼──────────────────────────────┼──────────┼──────────┤
│ notify-slack │ https://hooks.slack.com/xxx  │ 全部     │ ✅ 活跃  │
│ log-server   │ https://log.example.com/hook │ error.*  │ ✅ 活跃  │
│ old-hook     │ https://old.example.com      │ 全部     │ ⚪ 禁用  │
└──────────────┴──────────────────────────────┴──────────┴──────────┘

示例

bash
# 列出所有 Webhook
openclaw webhooks list

# 创建新 Webhook
openclaw webhooks create notify-slack \
  --url "https://hooks.slack.com/services/xxx" \
  --events "message.received,error.occurred"

# 测试 Webhook 投递
openclaw webhooks test notify-slack

# 查看 Webhook 投递日志
openclaw webhooks logs notify-slack

# 查看 Webhook 详情
openclaw webhooks inspect notify-slack

# 删除 Webhook
openclaw webhooks delete old-hook

# 仅列出活跃的 Webhook
openclaw webhooks list --active

相关命令

基于MIT协议开源 | 内容翻译自 官方文档,同步更新