BlueBubbles(macOS REST)
状态:内置插件,通过 HTTP 与 BlueBubbles macOS 服务器通信。由于其 API 更丰富且设置比旧版 imsg 渠道更简单,推荐用于 iMessage 集成。
概览
- 通过 BlueBubbles 辅助应用在 macOS 上运行(bluebubbles.app)。
- 推荐/已测试:macOS Sequoia(15)。macOS Tahoe(26)可用;目前编辑功能在 Tahoe 上已损坏,群组图标更新可能会报告成功但不会同步。
- OpenClaw 通过其 REST API 与其通信(
GET /api/v1/ping、POST /message/text、POST /chat/:id/*)。 - 传入消息通过 webhook 到达;传出回复、输入状态指示、已读回执和 tapback 都通过 REST 调用完成。
- 附件和贴纸会作为入站媒体接收(并在可能时展示给智能体)。
- 配对/allowlist 的工作方式与其他渠道相同(
/channels/pairing等),使用channels.bluebubbles.allowFrom+ 配对码。 - 回应会像 Slack/Telegram 一样作为系统事件呈现,因此智能体可以在回复前“提及”它们。
- 高级功能:编辑、撤回、回复线程、消息效果、群组管理。
快速开始
-
在你的 Mac 上安装 BlueBubbles 服务器(按照 bluebubbles.app/install 上的说明操作)。
-
在 BlueBubbles 配置中启用 Web API 并设置密码。
-
运行
openclaw onboard并选择 BlueBubbles,或手动配置:{
channels: {
bluebubbles: {
enabled: true,
serverUrl: "http://192.168.1.100:1234",
password: "example-password",
webhookPath: "/bluebubbles-webhook",
},
},
} -
将 BlueBubbles webhook 指向你的 Gateway 网关(示例:
https://your-gateway-host:3000/bluebubbles-webhook?password=<password>)。 -
启动 Gateway 网关;它会注册 webhook 处理器并开始配对。
安全说明:
- 始终设置 webhook 密码。
- 始终要求进行 webhook 身份验证。无论 loopback/代理拓扑如何,除非 BlueBubbles webhook 请求包含与
channels.bluebubbles.password匹配的 password/guid(例如?password=<password>或x-password),否则 OpenClaw 会拒绝该请求。 - 在读取/解析完整 webhook 请求体之前就会检查密码身份验证。
保持 Messages.app 处于活动状态(VM / 无头设置)
某些 macOS VM / 常开设置可能会导致 Messages.app 进入“空闲”状态(传入事件会停止,直到应用被打开/切到前台)。一个简单的解决方法是使用 AppleScript + LaunchAgent 每 5 分钟“触碰”一次 Messages。
1)保存 AppleScript
将以下内容保存为:
~/Scripts/poke-messages.scpt
示例脚本(非交互式;不会抢占焦点):
try
tell application "Messages"
if not running then
launch
end if
-- Touch the scripting interface to keep the process responsive.
set _chatCount to (count of chats)
end tell
on error
-- Ignore transient failures (first-run prompts, locked session, etc).
end try
2) 安装 LaunchAgent
将以下内容保存为:
~/Library/LaunchAgents/com.user.poke-messages.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.poke-messages</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-lc</string>
<string>/usr/bin/osascript "$HOME/Scripts/poke-messages.scpt"</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>300</integer>
<key>StandardOutPath</key>
<string>/tmp/poke-messages.log</string>
<key>StandardErrorPath</key>
<string>/tmp/poke-messages.err</string>
</dict>
</plist>
说明:
- 这会每 300 秒运行一次,并且在登录时运行。
- 首次运行可能会触发 macOS 的自动化权限提示(
osascript→ Messages)。请在运行该 LaunchAgent 的同一用户会话中批准这些提示。
加载它:
launchctl unload ~/Library/LaunchAgents/com.user.poke-messages.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/com.user.poke-messages.plist