通过飞书 OpenAPI 发送卡片消息(interactive card),支持模板化 JSON 卡片与变量替换。用于用户要求“发送飞书卡片/模板消息/互动卡片”时,或需要把结构化通知发到指定 open_id/chat_id 时。该技能只走 OpenAPI(appid/appsecret + tenant_acc...
用统一方式通过飞书 OpenAPI 发送卡片消息,避免每次手写 curl。
本技能固定使用 scripts/send_feishu_card.py(appid/appsecret 鉴权),不走 message 通道。
sender_id 作为 --receive-id(open_id)--receive-id + --receive-id-typeassets/templates/*.json,再用 --template + 变量替换脚本:scripts/send_feishu_card.py
按以下优先级自动获取(从高到低):
--app-id / --app-secretFEISHU_APP_ID / FEISHU_APP_SECRET/root/.openclaw/openclaw.json 的 channels.feishu.accounts
--account-id 指定账户(不传则取第一个)--account-id current 自动读取会话上下文 account_id(从运行时环境变量 best-effort 获取)# 1) 列出内置模板
python3 scripts/send_feishu_card.py --list-templates
# 2) 用 movie 模板发送到 open_id(变量文件)
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"
python3 scripts/send_feishu_card.py \
--template movie \
--receive-id ou_xxx \
--receive-id-type open_id \
--vars-file references/vars.example.env
# 3) 直接指定模板文件 + 行内变量
python3 scripts/send_feishu_card.py \
--template-file assets/templates/movie.json \
--receive-id ou_xxx \
--var title='星际穿越' \
--var rating='8.7'
# 4) 只有海报 URL 时,自动上传飞书并注入 poster_img_key
python3 scripts/send_feishu_card.py \
--template movie-custom \
--receive-id ou_xxx \
--receive-id-type open_id \
--poster-url 'https://image.tmdb.org/t/p/original/xxx.jpg' \
--var title='星际穿越' \
--var overview='...'
${key}--vars-file(KEY=VALUE)--var key=value发送前先读:
references/template-params.md(movie-custom)
references/template-params-tv.md(tv-custom)
文档定义了每个模板的必填参数、字段含义、示例命令。
cast(演员)字段必须按 Markdown 多行列表字符串传递。
scripts/send_feishu_card.py:获取 token、渲染模板、发送消息scripts/format_cast.py:把演员 JSON 自动转为 cast 字段字符串scripts/card_callback_router.py:卡片回调统一路由入口scripts/subscribe_callback_handler.py:处理“立即订阅”回调并写入 MoviePilot(含幂等)assets/templates/movie-custom.json:电影详情模板(movie)assets/templates/tv-custom.json:剧集详情模板(tv)assets/rules/*.rules.json:通用规则(支持 require_non_empty / default_value / 条件删减区块)references/vars.example.env:变量文件示例references/template-params.md:模板参数与传参格式规范当收到 Feishu 卡片回调消息时(message_id 形如 card-action-c-...,内容含 {"action":"subscribe"...}):
callback_token(从 message_id 去掉 card-action- 前缀)message_id。ZIP package — ready to use