{/* 本页面由 website/scripts/generate-skill-docs.py 从技能 SKILL.md 自动生成。请编辑源 SKILL.md 而非本页面。 */}

iMessage

使用 imsg 通过 macOS Messages.app 读取和发送 iMessage/SMS。

前提条件

  • macOS 且已登录 Messages.app
  • 安装:brew install steipete/tap/imsg
  • 授予终端完全磁盘访问权限(系统设置 → 隐私 → 完全磁盘访问权限)
  • 在提示时授予 Messages.app 的自动化权限

使用时机

  • 用户要求发送 iMessage 或短信
  • 阅读 iMessage 对话历史
  • 检查最近的 Messages.app 聊天
  • 向电话号码或 Apple ID 发送消息

何时不使用

  • Telegram/Discord/Slack/WhatsApp 消息 → 使用相应的网关通道
  • 群聊管理(添加/移除成员)→ 不支持
  • 批量/群发消息 → 始终先与用户确认

快速参考

列出聊天

imsg chats --limit 10 --json

查看历史

# 按聊天 ID
imsg history --chat-id 1 --limit 20 --json
 
# 带附件信息
imsg history --chat-id 1 --limit 20 --attachments --json

发送消息

# 仅文本
imsg send --to "+141****1212" --text "Hello!"
 
# 带附件
imsg send --to "+141****1212" --text "Check this out" --file /path/to/image.jpg
 
# 强制 iMessage 或 SMS
imsg send --to "+141****1212" --text "Hi" --service imessage
imsg send --to "+141****1212" --text "Hi" --service sms

监听新消息

imsg watch --chat-id 1 --attachments

服务选项

  • --service imessage — 强制 iMessage(需要接收方启用 iMessage)
  • --service sms — 强制 SMS(绿色气泡)
  • --service auto — 让 Messages.app 决定(默认)

规则

  1. 发送前始终确认接收者和消息内容
  2. 未经用户明确批准,切勿发送到未知号码
  3. 附加前验证文件路径是否存在
  4. 不要滥发——自我限制频率

示例工作流程

用户:“给妈妈发短信说我可能会迟到”

# 1. 查找妈妈的聊天
imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("Mom"))'
 
# 2. 与用户确认:"找到妈妈,号码为 +155****3456。通过 iMessage 发送'我可能会迟到'?"
 
# 3. 确认后发送
imsg send --to "+155****3456" --text "I'll be late"