消息管理
企微消息发送和管理命令
消息管理命令用于发送各种类型的企业微信消息。
| SKILL 名称 | 说明 |
|---|---|
juhecli-msg | 企微消息管理 - 发送文本/图片/文件/链接/语音/位置消息,群@消息,撤回,确认已读 |
conversation_id 格式说明
- 私聊:
S:+user_id(例如:S:7881303217905494) - 群聊:
R:+room_id(例如:R:10957014854528966)
发送文本消息
语法
bash
juhe-cli msg send_text '{"guid": "xxx", "conversation_id": "S:user_id", "content": "hello"}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID (私聊: S:user_id, 群聊: R:room_id) |
| content | string | 是 | 消息内容 |
示例
bash
# 私聊
juhe-cli msg send_text '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "content": "你好"}'
# 群聊
juhe-cli msg send_text '{"guid": "your-guid", "conversation_id": "R:10957014854528966", "content": "大家好"}'发送图片消息
语法
bash
juhe-cli msg send_image '{"guid": "xxx", "conversation_id": "S:user_id", "image_url": "..."}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| image_url | string | 是 | 图片URL地址 |
示例
bash
juhe-cli msg send_image '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "image_url": "https://example.com/image.jpg"}'发送文件消息
语法
bash
juhe-cli msg send_file '{"guid": "xxx", "conversation_id": "S:user_id", "file_url": "...", "file_name": "report.pdf"}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| file_url | string | 是 | 文件URL地址 |
| file_name | string | 是 | 文件名 |
示例
bash
juhe-cli msg send_file '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "file_url": "https://example.com/report.pdf", "file_name": "report.pdf"}'发送链接消息
语法
bash
juhe-cli msg send_link '{"guid": "xxx", "conversation_id": "S:user_id", "title": "...", "url": "...", "desc": "..."}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| title | string | 是 | 链接标题 |
| url | string | 是 | 链接地址 |
| desc | string | 否 | 链接描述 |
示例
bash
juhe-cli msg send_link '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "title": "产品介绍", "url": "https://example.com", "desc": "点击查看详情"}'发送群@消息
语法
bash
juhe-cli msg send_room_at '{"guid": "xxx", "conversation_id": "R:room_id", "content": "...", "at_list": ["user1"]}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID (群聊: R:room_id) |
| content | string | 是 | 消息内容 |
| at_list | string[] | 是 | @的用户ID列表 |
示例
bash
juhe-cli msg send_room_at '{"guid": "your-guid", "conversation_id": "R:10957014854528966", "content": "请查收", "at_list": ["user123"]}'发送语音消息
语法
bash
juhe-cli msg send_voice '{"guid": "xxx", "conversation_id": "S:user_id", "voice_url": "...", "voice_duration": 60}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| voice_url | string | 是 | 语音文件URL |
| voice_duration | number | 是 | 语音时长(秒) |
示例
bash
juhe-cli msg send_voice '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "voice_url": "https://example.com/voice.mp3", "voice_duration": 30}'发送位置消息
语法
bash
juhe-cli msg send_location '{"guid": "xxx", "conversation_id": "S:user_id", "longitude": 116.397, "latitude": 39.909, "title": "位置", "address": "地址"}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| longitude | number | 是 | 经度 |
| latitude | number | 是 | 纬度 |
| title | string | 是 | 位置名称 |
| address | string | 是 | 详细地址 |
示例
bash
juhe-cli msg send_location '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "longitude": 116.397, "latitude": 39.909, "title": "天安门", "address": "北京市东城区长安街"}'撤回消息
语法
bash
juhe-cli msg revoke '{"guid": "xxx", "conversation_id": "S:user_id", "msgid": "123456"}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| conversation_id | string | 是 | 会话ID |
| msgid | string | 是 | 消息ID |
示例
bash
juhe-cli msg revoke '{"guid": "your-guid", "conversation_id": "S:7881303217905494", "msgid": "123456"}'确认消息
语法
bash
juhe-cli msg confirm '{"guid": "xxx", "message_type": 0}'参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| guid | string | 是 | 设备唯一标识 |
| message_type | number | 是 | 消息类型 |
示例
bash
juhe-cli msg confirm '{"guid": "your-guid", "message_type": 0}'