Wecomcli Message logo

Wecomcli Message

OrganizationPopular
Pinvou
wecomcli-message

何时用:仅当用户明确指向企业微信(给企微同事/群发消息、查企微会话)时使用;泛指发消息默认走本地通讯工具,邮件走 wecomcli-email。查询可发消息的聊天会话范围,向单聊/群聊发送文本、Markdown、图片、文件、语音、视频消息。

Overview

PublisherPinvou
Repositorypinvou-agent
Skill namewecomcli-message
Stars
2K
Forks
281
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Pinvou on GitHub. Read the source before you install it.

Installation

Install the Wecomcli Message AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Pinvou/pinvou-agent.git /tmp/pinvou-agent
mkdir -p .claude/skills
cp -r /tmp/pinvou-agent/pinvou3-app/src-tauri/resources/common/bundle/wecom-skills/wecomcli-message .claude/skills/wecomcli-message
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wecomcli Message in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Wecomcli Message on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Wecomcli Message is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

企业微信发送消息

执行任何 wecom-cli 命令前,必须先读取并完成 wecomcli-shared 技能的公共前置检查。

  1. 可以向授权人发送消息。
  2. 可以向授权人以外的、机器人最近有消息往来的聊天会话(单聊和群聊)发送消息。

适用范围

适用

  • 适用于给授权人发消息,使用 wecom-cli identity whoami 获取授权人ID,可作为 chat_id 使用,无需调用 sessions list
  • 适用于查询当前有权限发送消息的聊天会话范围并给这些范围中的成员或群聊发送 Markdown 消息、图片、文件、AMR 语音或视频

不适用

  • 发送对象不是授权人且不在本次 sessions list 返回结果中 → 告知用户当前只能向最近活跃的会话或授权人发送

技能依赖

调用依赖技能前,必须先完整读取对应 SKILL.md

依赖技能触发场景数据流向
wecomcli-media发送图片、文件、语音或视频时只有本地文件路径,没有可直接复用的 media_id包含媒体上传接口,如没有已有的 media_id,必须先阅读该技能获取 media_idmedia upload 以本地 file_path 上传,type 为可选入参(image/voice/video/file);发送时以上传响应返回的 type 对齐 msg_type

获取能发送消息的会话列表

命令

bash
wecom-cli message aibot sessions list

返回

字段类型说明
sessionsarray会话列表,按最后一条消息时间从新到旧排序,具体数量以实际回包为准
sessions[].chat_idstring会话 ID
sessions[].chat_namestring群名称或单聊名称
sessions[].chat_typestringsingle 单聊或 group 群聊
sessions[].last_msg_timestring最后一条消息时间,格式 YYYY-MM-DD HH:MM:SS
sessions_countintegersessions 数组元素数量

chat_id 来源

向授权人以外的用户发送消息,调用 wecom-cli message aibot send 前,需要先调用一次 sessions list,然后从本次返回的 sessions[] 中选定目标项,把该项的 chat_id 原样复制到 send.chat_id

以下值都不能直接作为 send.chat_id

  • 用户输入的 ID
  • 之前轮次或历史上下文保存的 chat_id
  • wecomcli-contact 返回的 userid
  • 根据姓名、群名或其他字段自行构造的值

这些值最多只能作为匹配线索;最终发送参数必须重新取自本次 sessions list 的匹配项。

目标会话匹配

  • 聊天名称:在本次 sessions[] 中按非空 chat_name 精确匹配;不能精确匹配需要向用户反问确认发送目标,唯一命中时从匹配项复制 chat_id
  • 最近第一个/最近某个会话:按 sessions[] 原始顺序选择用户明确指定的项。
  • 用户提供 ID:只能与本次 sessions[].chat_id 做完全相等校验;命中后仍从匹配项复制 chat_id,不能直接复用用户输入值。

匹配结果处理:

  • 唯一匹配时继续发送。
  • 多个聊天会话候选时,按返回顺序展示聊天名和最后消息时间,让用户选择。
  • 用户完成选择后,必须重新调用 sessions list,再用选定对象匹配当次返回值。
  • 无匹配时停止发送,如实告知目标不在本次返回的最近会话中;不要接受外部 chat_id 绕过限制。
  • sessions_count=0 时停止发送,告知当前没有可发送的最近会话。
  • 展示会话列表时保持接口原始顺序;展示名称和时间,不展示内部 chat_id

发送消息

前置条件

调用本接口前必须完成以下步骤:

  1. 根据发送对象选择调用 wecom-cli message aibot sessions list获取 chat_idwecom-cli identity whoami 获取授权人ID。
  2. 在本次列表中唯一匹配目标。
  3. 如果发送授权人以外的对象,从列表中匹配项原样复制 sessions[].chat_id
  4. 目标是媒体消息时,再准备对应的 media_id

在目标会话匹配成功前,不上传媒体,也不调用 send

命令

bash
wecom-cli message aibot send --json '<JSON 参数>'

公共参数

字段类型必填说明
chat_idstring必须取自 wecom-cli identity whoami 或当前发送流程中刚调用的 sessions list 返回的目标 sessions[].chat_id
msg_typestringmarkdown / image / file / voice / video
markdownobject条件必填msg_type="markdown" 时传
imageobject条件必填msg_type="image" 时传
fileobject条件必填msg_type="file" 时传
voiceobject条件必填msg_type="voice" 时传
videoobject条件必填msg_type="video" 时传

每次请求必须且只能携带一个与 msg_type 同名的内容对象。不要传空对象,也不要同时传多个消息对象。

Markdown 消息

markdown.content 必填,最长 20480 UTF-8 字节。普通文本也按 Markdown 发送。

bash
wecom-cli message aibot send --json '{
  "chat_id": "<本次 sessions[].chat_id>",
  "msg_type": "markdown",
  "markdown": {
    "content": "<markdown 消息内容>"
  }
}'

图片消息

image.media_id 必填,必须来自媒体上传接口上传后返回 type=image 的结果。

bash
wecom-cli message aibot send --json '{
  "chat_id": "<本次 sessions[].chat_id>",
  "msg_type": "image",
  "image": {
    "media_id": "<media_id>"
  }
}'

文件消息

file.media_id 必填,必须来自媒体上传接口上传后返回 type=file 的结果;文件名取上传时的原始文件名。

bash
wecom-cli message aibot send --json '{
  "chat_id": "<本次 sessions[].chat_id>",
  "msg_type": "file",
  "file": {
    "media_id": "<media_id>"
  }
}'

语音消息

voice.media_id 必填,必须来自媒体上传接口上传后返回 type=voice 的结果;源文件仅支持 AMR 格式,不能只改扩展名冒充 AMR。

bash
wecom-cli message aibot send --json '{
  "chat_id": "<本次 sessions[].chat_id>",
  "msg_type": "voice",
  "voice": {
    "media_id": "<media_id>"
  }
}'

视频消息

字段必填说明
video.media_id来自媒体上传接口上传后返回 type=video 的结果
video.title最长 128 UTF-8 字节;省略时使用上传时的原始文件名
video.description最长 512 UTF-8 字节;省略时不展示描述
bash
wecom-cli message aibot send --json '{
  "chat_id": "<本次 sessions[].chat_id>",
  "msg_type": "video",
  "video": {
    "media_id": "<media_id>",
    "title": "产品演示",
    "description": "本周版本的核心功能演示"
  }
}'

用户没有提供视频标题或描述时直接省略对应字段,不传空字符串,也不追问非必填字段。

关键约束

  • 用户明确要求发送且目标与内容完整时直接执行,不重复追问确认;缺少目标、内容或本地文件时只追问缺失项。
  • 连续发送多条时,不用每次 send 前都重新调用 sessions listwecom-cli identity whoami,但连续发送中途上下文发生压缩时重新调用确保 chat_id 正确。
  • chat_iduseridmedia_id 都是内部调用值,禁止面向用户展示。
  • Markdown 正文、视频标题和描述限制按 UTF-8 字节数计算;超限时不静默截断,请用户缩短或明确同意拆分。
  • 发送成功后只说明目标和消息类型,不编造消息 ID。
  • 接口失败时如实转达错误,不使用 curl / Python 等方式绕过 wecom-cli

Frequently asked questions

What does the Wecomcli Message AI skill do?

何时用:仅当用户明确指向企业微信(给企微同事/群发消息、查企微会话)时使用;泛指发消息默认走本地通讯工具,邮件走 wecomcli-email。查询可发消息的聊天会话范围,向单聊/群聊发送文本、Markdown、图片、文件、语音、视频消息。

Why use Wecomcli Message on TypingMind?

Because you install it once and use it with any model. Wecomcli Message is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Wecomcli Message in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Pinvou/pinvou-agent/tree/main/pinvou3-app/src-tauri/resources/common/bundle/wecom-skills/wecomcli-message. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Wecomcli Message?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Wecomcli Message?

As many as you like. As long as a model supports skills, you can use Wecomcli Message with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Wecomcli Message AI skill free?

Yes. It is published on GitHub by Pinvou under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇