狀態:舊版外部 CLI 整合。Gateway 會啟動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.
imsg rpc,並透過 stdio 上的 JSON-RPC 通訊(沒有獨立的守護程式/連接埠)。
BlueBubbles (recommended)
新設定建議使用的 iMessage 路徑。
Pairing
iMessage 私訊預設使用配對模式。
Configuration reference
完整的 iMessage 欄位參考。
快速設定
- Local Mac (fast path)
- Remote Mac over SSH
需求與權限(macOS)
- Messages 必須已在執行
imsg的 Mac 上登入。 - 執行 OpenClaw/
imsg的程序環境需要完整磁碟存取權(Messages 資料庫存取)。 - 需要自動化權限,才能透過 Messages.app 傳送訊息。
存取控制與路由
- DM policy
- Group policy + mentions
- Sessions and deterministic replies
channels.imessage.dmPolicy 控制直接訊息:pairing(預設)allowlistopen(需要allowFrom包含"*")disabled
channels.imessage.allowFrom。Allowlist 項目可以是 handle 或聊天目標(chat_id:*、chat_guid:*、chat_identifier:*)。ACP 對話繫結
舊版 iMessage 聊天也可以繫結到 ACP sessions。 快速操作流程:- 在私訊或允許的群組聊天內執行
/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 可以使用:
- 標準化的私訊 handle,例如
+15555550123或user@example.com chat_id:<id>(建議用於穩定的群組繫結)chat_guid:<guid>chat_identifier:<identifier>
部署模式
Dedicated bot macOS user (separate iMessage identity)
Dedicated bot macOS user (separate iMessage identity)
使用專用 Apple ID 和 macOS 使用者,讓 bot 流量與你的個人 Messages profile 隔離。典型流程:
- 建立/登入專用 macOS 使用者。
- 在該使用者中使用 bot Apple ID 登入 Messages。
- 在該使用者中安裝
imsg。 - 建立 SSH wrapper,讓 OpenClaw 可以在該使用者環境中執行
imsg。 - 將
channels.imessage.accounts.<id>.cliPath和.dbPath指向該使用者 profile。
Remote Mac over Tailscale (example)
Remote Mac over Tailscale (example)
常見拓撲:使用 SSH 金鑰,讓 SSH 和 SCP 都能非互動執行。
請先確保主機金鑰已受信任(例如
- gateway 在 Linux/VM 上執行
- iMessage +
imsg在你 tailnet 中的一台 Mac 上執行 cliPathwrapper 使用 SSH 執行imsgremoteHost啟用 SCP 附件擷取
ssh bot@mac-mini.tailnet-1234.ts.net),讓 known_hosts 已填入。Multi-account pattern
Multi-account pattern
iMessage 支援
channels.imessage.accounts 下的逐帳號設定。每個帳號都可以覆寫 cliPath、dbPath、allowFrom、groupPolicy、mediaMaxMb、history settings,以及附件根目錄 allowlists 等欄位。媒體、分塊與遞送目標
Attachments and media
Attachments and media
- 傳入附件擷取是選用的:
channels.imessage.includeAttachments - 設定
remoteHost時,可以透過 SCP 擷取遠端附件路徑 - 附件路徑必須符合允許的根目錄:
channels.imessage.attachmentRoots(本機)channels.imessage.remoteAttachmentRoots(遠端 SCP 模式)- 預設根目錄 pattern:
/Users/*/Library/Messages/Attachments
- SCP 使用嚴格的主機金鑰檢查(
StrictHostKeyChecking=yes) - 傳出媒體大小使用
channels.imessage.mediaMaxMb(預設 16 MB)
Outbound chunking
Outbound chunking
- 文字分塊限制:
channels.imessage.textChunkLimit(預設 4000) - 分塊模式:
channels.imessage.chunkModelength(預設)newline(段落優先切分)
Addressing formats
Addressing formats
建議的明確目標:
chat_id:123(建議用於穩定路由)chat_guid:...chat_identifier:...
imessage:+1555...sms:+1555...user@example.com
設定寫入
iMessage 預設允許 channel 發起的設定寫入(適用於commands.config: true 時的 /config set|unset)。
停用:
疑難排解
imsg not found or RPC unsupported
imsg not found or RPC unsupported
驗證 binary 與 RPC 支援:如果 probe 回報 RPC 不受支援,請更新
imsg。DMs are ignored
DMs are ignored
檢查:
channels.imessage.dmPolicychannels.imessage.allowFrom- 配對核准(
openclaw pairing list imessage)
Group messages are ignored
Group messages are ignored
檢查:
channels.imessage.groupPolicychannels.imessage.groupAllowFromchannels.imessage.groupsallowlist 行為- 提及 pattern 設定(
agents.list[].groupChat.mentionPatterns)
Remote attachments fail
Remote attachments fail
檢查:
channels.imessage.remoteHostchannels.imessage.remoteAttachmentRoots- 來自 gateway host 的 SSH/SCP 金鑰驗證
- gateway host 上的
~/.ssh/known_hosts中存在主機金鑰 - 執行 Messages 的 Mac 上的遠端路徑可讀性
macOS permission prompts were missed
macOS permission prompts were missed
在同一使用者/session 環境中的互動式 GUI terminal 重新執行並核准提示:確認完整磁碟存取 + 自動化已授予執行 OpenClaw/
imsg 的程序環境。設定參考指標
相關
- Channels Overview — 所有支援的 channels
- 配對 — 私訊驗證與配對流程
- 群組 — 群組聊天行為與提及 gating
- Channel Routing — 訊息的 session 路由
- 安全性 — 存取模型與強化措施