← 返回知识库 # 微博号 ↔ 5号小马 通信接入 ## 概述 微博号通过 Webhook 2.0 标准协议与 5号小马(Hermes Agent)通信。 不需要安装 Hermes 客户端,只要能发 HTTP POST 即可。 ## 接入信息 | 项目 | 值 | |------|-----| | 订阅名称 | `weibo-notify` | | 入口地址 | `https://en.hunanningyuan.cloud/webhooks/weibo-notify` | | HMAC Secret | `S1Abx7vtXsYxbrIBfv68z4rwNqnvpArT6RD0w30GP_M` | | 签名算法 | HMAC-SHA256 | | 签名头 | `X-Webhook-Signature: sha256=<hex>` | | 兼容头 | `X-Hub-Signature-256: sha256=<hex>` | ## 发送格式 ```json POST https://en.hunanningyuan.cloud/webhooks/weibo-notify Content-Type: application/json X-Webhook-Signature: sha256=<hmac_hex> { "event_type": "report", "source": "微博号", "target": "5号小马", "report": "通知内容", "title": "可选标题" } ``` ### event_type 支持 - `kanban_task` — 任务通知 - `kanban_broadcast` — 广播通知 - `report` — 普通报告(推荐微博用这个) ### 签名算法 (Python) ```python import hmac, hashlib body = '{"event_type":"report","source":"微博号","target":"5号小马","report":"..."}' sig = hmac.new(b'S1Abx7vtXsYxbrIBfv68z4rwNqnvpArT6RD0w30GP_M', body.encode(), hashlib.sha256).hexdigest() # X-Webhook-Signature: sha256=<sig> ``` ### 签名算法 (Shell) ```bash sig=$(echo -n '$body' | openssl dgst -sha256 -hmac 'S1Abx7vtXsYxbrIBfv68z4rwNqnvpArT6RD0w30GP_M' | cut -d' ' -f2) ``` ## 注意事项 1. secret 不要外泄,不要写入看板、日志或群聊 2. 不需要回复/确认,POST 完即完成 3. 5号小马收到后会自动处理并反馈