Google Messages技能使用说明
2026-04-01
新闻来源:网淘吧
围观:11
电脑广告
手机广告
Google Messages 浏览器技能
通过使用浏览器工具,在 messages.google.com 上实现 SMS/RCS 消息的自动化。概述Google Messages for Web 允许您通过浏览器从您的 Android 手机发送/接收短信。此技能可自动化该界面。
要求:
装有 Google Messages 应用的 Android 手机

手机和电脑在同一网络(用于初始二维码配对)
- 具有持久会话的浏览器配置文件(使用 openclaw 或您偏好的配置文件)
- 注意:
- 如果不同,请将示例中的 profile=openclaw 替换为您偏好的浏览器配置文件。
快速参考操作
命令打开配对页面browser action=open profile=openclaw targetUrl="https://messages.google.com/web/authentication"in examples with your preferred browser profile if different.
Quick Reference
| Action | Command |
|---|---|
| Open pairing page | browser action=open profile=openclaw targetUrl="https://messages.google.com/web/authentication" |
| 检查会话 | 浏览器 动作=截图 配置文件=openclaw— 查找对话列表与二维码 |
| 截图 | 浏览器 动作=截图 配置文件=openclaw |
初始设置(二维码配对)
首次设置需要扫描二维码:
-
打开 Google Messages 网页版
browser action=open profile=openclaw targetUrl="https://messages.google.com/web/authentication" -
截图二维码并与用户分享
browser action=screenshot profile=openclaw -
用户用手机扫描:
- 在 Android 上打开 Google Messages 应用
- 点击 ⋮ 菜单 → "设备配对" → "二维码扫描器"
- 扫描二维码
-
验证连接— 截图应显示对话列表,而非二维码
重要提示:启用"记住此电脑"以保持会话。
发送消息
-
导航至对话
browser action=navigate profile=openclaw targetUrl="https://messages.google.com/web/conversations" -
截图并查找对话
browser action=snapshot profile=openclaw在对话列表中查找联系人,注意
引用。 -
点击对话
browser action=act profile=openclaw request={"kind": "click", "ref": "<ref>"} -
输入消息(从快照中查找文本区域的引用)
browser action=act profile=openclaw request={"kind": "type", "ref": "<input_ref>", "text": "Your message"} -
点击发送(查找发送按钮的引用)
browser action=act profile=openclaw request={"kind": "click", "ref": "<send_ref>"}
接收消息(实时通知)
此技能包含一个用于实时接收短信通知的webhook系统。
组件
- sms-webhook-server.js——接收通知,并转发至OpenClaw频道
- sms-observer.js——用于监控新消息的浏览器脚本
设置
-
设置环境变量:
export SMS_NOTIFICATION_TARGET="telegram:YOUR_CHAT_ID" export SMS_NOTIFICATION_CHANNEL="telegram" -
启动webhook服务器:
node <skill>/sms-webhook-server.js -
将观察者注入浏览器(参见
references/observer-injection.md)
Systemd 服务(持久化)
cp <skill>/systemd/google-messages-webhook.service ~/.config/systemd/user/
# Edit service file: set SMS_NOTIFICATION_TARGET in Environment=
systemctl --user daemon-reload
systemctl --user enable --now google-messages-webhook
读取消息
请参考references/snippets.md中的 JavaScript 代码片段,用于:
- 获取最近的对话
- 获取当前对话中的消息
- 检查会话状态
故障排除
| 问题 | 解决方案 |
|---|---|
| 显示二维码 | 会话已过期,请重新配对 |
| 元素未找到 | 谷歌更新了界面,请检查快照以获取新的选择器 |
| 发送按钮被禁用 | 消息输入为空或手机已断开连接 |
| 观察器未检测到 | 检查浏览器控制台中的[短信观察器]日志 |
| Webhook 未接收 | 验证服务器是否正在运行:curl http://127.0.0.1:19888/health |
选择器参考
Google Messages 使用 Angular 组件。这些组件可能会随更新而改变。
| 元素 | 选择器 |
|---|---|
| 对话列表 | mws-conversations-list |
| 对话项目 | mws-conversation-list-item |
| 消息输入框 | textarea[aria-label*="message"] |
| 发送按钮 | button[aria-label*="Send"] |
| 二维码 | mw-qr-code |
限制
- 手机必须在线(消息通过手机同步)
- 浏览器标签页必须保持打开以接收通知
- 会话在约14天无活动后过期
- 页面重新加载后观察器会丢失(需要重新注入)
安全性
- Webhook 仅监听本地主机(127.0.0.1)
- 未存储任何凭据(会话保存在浏览器 Cookie 中)
- QR 配对链接至您的手机——请谨慎对待
许可证
Apache-2.0
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~