openclaw-feishu-card-callback-business-handle
v0.1.0
Published
OpenClaw plugin that registers Feishu card callback payload business handlers
Readme
OpenClaw Feishu Card Callback Business Handle
这个插件为 openclaw-feishu-card-callback-bridge 注册 payload 级业务处理逻辑。当前内置 PipeChina close 和 dispatch 两个 handler。
工作方式
business-handle 启动
-> 注册 payload handlers: close, dispatch
bridge 收到 custom-button:close
-> 按 payload=close 查询共享 registry
-> 调用 business-handle 注册的 handler
-> bridge 负责把 handler 返回结果写回飞书会话business-handle 不注册飞书 namespace,也不直接发送 follow-up 消息。响应方式统一由 bridge 的 echoMode 控制。
安装
cd /Users/chenzeping/go/src/code.byted.org/epscp/fde-skills/common/plugins/openclaw-feishu-card-callback-business-handle
npm install --no-package-lock --silent
npm run build
openclaw plugins install "$(pwd)"同时需要安装 bridge:
cd /Users/chenzeping/go/src/code.byted.org/epscp/fde-skills/common/plugins/openclaw-feishu-card-callback-bridge
npm run build
openclaw plugins install "$(pwd)"配置
{
"plugins": {
"openclaw-feishu-card-callback-bridge": {
"namespaces": ["custom-button"]
},
"openclaw-feishu-card-callback-business-handle": {
"pipechinaApiBase": "http://118.196.94.41:32233/api/alarm"
}
}
}pipechinaApiBase fallback 顺序:
- 插件配置
pipechinaApiBase - 环境变量
PIPECHINA_API_BASE - 内置默认值
http://118.196.94.41:32233/api/alarm
内置 Handler
| Payload | 行为 |
| --- | --- |
| close | 调用 PipeChina /closeAlert,请求体包含 messageId 和 alarmId |
| dispatch | 调用 PipeChina /dispatch,请求体包含 messageId、alarmId 和 owner |
字段提取规则:
alarmId从value.alarm_id、value.alarmId、value.alarmID、value.id中按顺序读取。messageId来自飞书回调里的open_message_id。owner优先使用value.owner,否则使用点击者operator.open_id。
新增 Handler
在 index.ts 中注册新的 payload:
registerFeishuCardActionHandler('ack', async (ctx, extras, options) => {
options.logger?.info?.(`ack payload received messageId=${ctx.messageId ?? ''}`);
return {
status: 'success',
messageTemplate: '{senderMention} 已确认 {actionLabel}',
};
});卡片按钮保持 <namespace>:<payload> 格式:
{
"tag": "button",
"text": { "tag": "plain_text", "content": "确认" },
"behaviors": [
{
"type": "callback",
"value": {
"action": "custom-button:ack",
"alarm_id": "alarm-1"
}
}
]
}构建和打包
本仓库根目录 .gitignore 会忽略插件下的 node_modules/ 和 dist/。交付前需要本地构建产物。
cd /Users/chenzeping/go/src/code.byted.org/epscp/fde-skills/common/plugins/openclaw-feishu-card-callback-business-handle
npm install --no-package-lock --silent
npm run build
npm run verify:business
npm pack --dry-run交付前确认:
npm run build通过。npm run verify:business通过。dist/index.js存在。npm pack --dry-run输出包含dist/、openclaw.plugin.json、README.md、package.json。- 不要提交
node_modules/、dist/或*.tgz。
