Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
對於新的 OpenClaw iMessage 部署,若你可以在已登入的 macOS Messages 主機上執行
imsg,請從這裡開始。BlueBubbles 仍可作為舊版備援,用於依賴其 HTTP 伺服器、webhooks 或更豐富私有 API 動作的現有設定。imsg rpc,並透過 stdio 上的 JSON-RPC 通訊(不需要獨立的 daemon/port)。
BlueBubbles(舊版備援)
現有以 BlueBubbles 支援的路由可繼續使用;若 imsg 適用,新的設定請避免使用它。
配對
iMessage DM 預設為配對模式。
設定參考
完整的 iMessage 欄位參考。
快速設定
- 本機 Mac(快速路徑)
- 透過 SSH 使用遠端 Mac
需求與權限(macOS)
- 執行
imsg的 Mac 必須已登入 Messages。 - 執行 OpenClaw/
imsg的 process context 需要 Full Disk Access(Messages DB 存取)。 - 需要 Automation 權限,才能透過 Messages.app 傳送訊息。
存取控制與路由
- DM 政策
- 群組政策 + 提及
- 工作階段與確定性回覆
channels.imessage.dmPolicy 控制 direct messages:pairing(預設)allowlistopen(需要allowFrom包含"*")disabled
channels.imessage.allowFrom。Allowlist 項目可以是 handles 或聊天目標(chat_id:*、chat_guid:*、chat_identifier:*)。ACP 對話繫結
舊版 iMessage chats 也可以繫結到 ACP sessions。 快速操作流程:- 在 DM 或允許的群組聊天中執行
/acp spawn codex --bind here。 - 同一個 iMessage 對話中的後續訊息會路由到已啟動的 ACP session。
/new和/reset會就地重設同一個已繫結的 ACP session。/acp close會關閉 ACP session 並移除繫結。
bindings[] 項目支援已設定的持久繫結,並使用 type: "acp" 和 match.channel: "imessage"。
match.peer.id 可以使用:
- 正規化的 DM handle,例如
+15555550123或user@example.com chat_id:<id>(建議用於穩定的群組繫結)chat_guid:<guid>chat_identifier:<identifier>
部署模式
專用 bot macOS 使用者(獨立 iMessage 身分)
專用 bot macOS 使用者(獨立 iMessage 身分)
使用專用 Apple ID 與 macOS 使用者,讓 bot 流量與你的個人 Messages profile 隔離。典型流程:
- 建立/登入專用 macOS 使用者。
- 在該使用者中用 bot Apple ID 登入 Messages。
- 在該使用者中安裝
imsg。 - 建立 SSH wrapper,讓 OpenClaw 可在該使用者 context 中執行
imsg。 - 將
channels.imessage.accounts.<id>.cliPath和.dbPath指向該使用者 profile。
透過 Tailscale 使用遠端 Mac(範例)
透過 Tailscale 使用遠端 Mac(範例)
常見拓撲:使用 SSH 金鑰,讓 SSH 和 SCP 都不需要互動。
請先確保主機金鑰已受信任(例如
- gateway 在 Linux/VM 上執行
- iMessage +
imsg在你 tailnet 中的 Mac 上執行 cliPathwrapper 使用 SSH 來執行imsgremoteHost啟用 SCP 附件擷取
ssh bot@mac-mini.tailnet-1234.ts.net),使 known_hosts 已填入。多帳號模式
多帳號模式
iMessage 支援在
channels.imessage.accounts 下進行個別帳號設定。每個帳號都可以覆寫 cliPath、dbPath、allowFrom、groupPolicy、mediaMaxMb、歷史記錄設定,以及附件根路徑 allowlists 等欄位。媒體、分段與傳遞目標
附件與媒體
附件與媒體
- inbound 附件擷取是選用的:
channels.imessage.includeAttachments - 設定
remoteHost時,可以透過 SCP 擷取遠端附件路徑 - 附件路徑必須符合允許的根路徑:
channels.imessage.attachmentRoots(本機)channels.imessage.remoteAttachmentRoots(遠端 SCP 模式)- 預設根路徑 pattern:
/Users/*/Library/Messages/Attachments
- SCP 使用嚴格 host-key 檢查(
StrictHostKeyChecking=yes) - outbound 媒體大小使用
channels.imessage.mediaMaxMb(預設 16 MB)
Outbound 分段
Outbound 分段
- 文字分段限制:
channels.imessage.textChunkLimit(預設 4000) - 分段模式:
channels.imessage.chunkModelength(預設)newline(段落優先切分)
定址格式
定址格式
建議使用明確目標:
chat_id:123(建議用於穩定路由)chat_guid:...chat_identifier:...
imessage:+1555...sms:+1555...user@example.com
設定寫入
iMessage 預設允許 channel 啟動的設定寫入(當commands.config: true 時用於 /config set|unset)。
停用:
疑難排解
找不到 imsg 或不支援 RPC
找不到 imsg 或不支援 RPC
驗證 binary 和 RPC 支援:如果 probe 回報不支援 RPC,請更新
imsg。DM 被忽略
DM 被忽略
檢查:
channels.imessage.dmPolicychannels.imessage.allowFrom- 配對核准(
openclaw pairing list imessage)
群組訊息被忽略
群組訊息被忽略
檢查:
channels.imessage.groupPolicychannels.imessage.groupAllowFromchannels.imessage.groupsallowlist 行為- 提及 pattern 設定(
agents.list[].groupChat.mentionPatterns)
遠端附件失敗
遠端附件失敗
檢查:
channels.imessage.remoteHostchannels.imessage.remoteAttachmentRoots- 來自 gateway 主機的 SSH/SCP 金鑰驗證
- host key 存在於 gateway 主機上的
~/.ssh/known_hosts - 執行 Messages 的 Mac 上遠端路徑的可讀性
錯過了 macOS 權限提示
錯過了 macOS 權限提示
在相同使用者/session context 的互動式 GUI terminal 中重新執行,並核准提示:確認執行 OpenClaw/
imsg 的 process context 已授予 Full Disk Access + Automation。