用途:wacli 是 WhatsApp 的 CLI 工具,仅在用户明确要求你向他人发送 WhatsApp 消息,或要求同步、搜索 WhatsApp 历史记录时使用。普通用户聊天不要使用它,Moltbot 会自动路由 WhatsApp 对话;如果用户正在 WhatsApp 上与你聊天,除非他们要求联系第三方,否则不应调用此工具。
主要能力:认证与同步、查找聊天与消息、历史回填、发送文本/群组/文件消息。
使用方式:认证与同步用 wacli auth(扫码登录并初始同步)、wacli sync --follow(持续同步)、wacli doctor。查找聊天与消息用 wacli chats list --limit 20 --query "name or number"、wacli messages search "query" --limit 20 --chat <jid>、wacli messages search "invoice" --after 2025-01-01 --before 2025-12-31。历史回填用 wacli history backfill --chat <jid> --requests 2 --count 50。发送文本用 wacli send text --to "+14155551212" --message "Hello! Are you free at 3pm?",群组用 wacli send text --to "1234567890-123456789@g.us" --message "Running 5 min late.",文件用 wacli send file --to "+14155551212" --file /path/agenda.pdf --caption "Agenda"。
安全要求:必须提供明确的收件人和消息文本;发送前确认收件人和消息;如有歧义先提问澄清。
限制与说明:存储目录为 ~/.wacli(可用 --store 覆盖);解析时用 --json 获取机器可读输出;回填需要手机在线,结果尽力而为;JID 中直接聊天形如 <number>@s.whatsapp.net,群组形如 <id>@g.us(可用 wacli chats list 查找)。