mcpField
W
wechat-message

wechat-message

github.com/tiancheng91Productivity130 installs
Repository

About wechat-message

wechat-message automates sending WeChat messages on macOS with AppleScript. It is for users who need to message a named contact or group, and supports Chinese and special characters.

Key features

  1. 01Activate WeChat and search contacts or groups
  2. 02Send specified message text
  3. 03Support Chinese and special characters
  4. 04Run through an AppleScript command

Use cases

  1. 01Message a specified friend
  2. 02Send a notice to a work group

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/tiancheng91/wechat-msg-send --skill wechat-message

After installing, type/wechat-messagein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
examples/
sample.md
scripts/
wechat_automation_script.applescript

Details

From the project README

微信消息发送技能

此技能通过 AppleScript 脚本实现 macOS 上微信消息的自动化发送。

功能概述

  • 自动激活微信应用
  • 搜索指定联系人或群组
  • 发送指定消息内容
  • 支持中文和特殊字符

使用方法

调用方式
osascript scripts/wechat_automation_script.applescript "<用户名>" "<消息内容>"
参数说明
参数必填说明
用户名是微信联系人名称或群名称,需完全匹配
消息内容是要发送的消息文本
使用示例
# 发送消息给好友
osascript scripts/wechat_automation_script.applescript "张三" "你好,今天有空吗?"

# 发送消息到群组
osascript scripts/wechat_automation_script.applescript "工作群" "大家好!"

# 发送包含中文的消息
osascript scripts/wechat_automation_script.applescript "Yatocala" "hello你好"

工作流程

  1. 激活微信 - 将微信窗口置于最前
  2. 打开搜索 - 使用 Cmd+F 打开联系人搜索框
  3. 搜索联系人 - 粘贴用户名并选择第一个匹配结果
  4. 定位输入框 - 通过 Tab 键和点击确保焦点在输入框
  5. 发送消息 - 粘贴消息内容并按回车发送
  6. 隐藏窗口 - 发送完成后隐藏微信窗口

注意事项

  • 微信必须已登录 - 执行前确保微信应用已登录
  • 联系人名称需精确匹配 - 搜索时会选择第一个匹配结果
  • 执行时间约 15 秒 - 脚本包含多个延时以确保稳定性
  • 需要辅助功能权限 - 首次使用需授予 System Events 辅助功能权限

权限配置

如果脚本执行失败,请检查以下权限:

  1. 系统偏好设置 → 安全性与隐私 → 隐私
  2. 选择 辅助功能
  3. 确保以下应用已添加并勾选:
    • Terminal(或你使用的终端应用)
    • System Events

故障排除

问题可能原因解决方案
消息未发送焦点未在输入框检查 Tab 键次数是否足够
搜索不到联系人名称不匹配确认联系人名称完全一致
脚本执行中断权限不足检查辅助功能权限
发送中文乱码编码问题确保终端使用 UTF-8 编码

文件结构

wechat-message/
├── SKILL.md                              # 主说明文档
├── template.md                           # 消息模板
├── examples/
│   └── sample.md                         # 使用示例
└── scripts/
    └── wechat_automation_script.applescript  # AppleScript 脚本

Comments

Markdown supported