跳转到主要内容

消息管理

企微消息发送和管理命令

消息管理命令用于发送各种类型的企业微信消息。

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"}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID (私聊: S:user_id, 群聊: R:room_id)
contentstring消息内容

示例

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": "..."}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
image_urlstring图片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"}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
file_urlstring文件URL地址
file_namestring文件名

示例

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": "..."}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
titlestring链接标题
urlstring链接地址
descstring链接描述

示例

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"]}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID (群聊: R:room_id)
contentstring消息内容
at_liststring[]@的用户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}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
voice_urlstring语音文件URL
voice_durationnumber语音时长(秒)

示例

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": "地址"}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
longitudenumber经度
latitudenumber纬度
titlestring位置名称
addressstring详细地址

示例

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"}'

参数

参数类型必填说明
guidstring设备唯一标识
conversation_idstring会话ID
msgidstring消息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}'

参数

参数类型必填说明
guidstring设备唯一标识
message_typenumber消息类型

示例

bash
juhe-cli msg confirm '{"guid": "your-guid", "message_type": 0}'