iMessage (eski: imsg)
Tavsiya etiladi: yangi iMessage sozlamalari uchun BlueBubbles dan foydalaning.
imsg kanali — legacy tashqi CLI integratsiyasi bo‘lib, kelajakdagi relizda olib tashlanishi mumkin.
Holat: legacy tashqi CLI integratsiyasi. Gateway imsg rpc ni ishga tushiradi (stdio orqali JSON-RPC).
Tezkor sozlash (boshlovchilar uchun)
- Ensure Messages is signed in on this Mac.
imsgni o‘rnating:brew install steipete/tap/imsg
- OpenClaw ni
channels.imessage.cliPathvachannels.imessage.dbPathbilan sozlang. - Gateway’ni ishga tushiring va macOS so‘rovlarini tasdiqlang (Automation + Full Disk Access).
Bu nima
- macOS’da
imsgga asoslangan iMessage kanali. - Deterministik yo‘naltirish: javoblar har doim iMessage’ga qaytadi.
- DM’lar agentning asosiy sessiyasini ulashadi; guruhlar esa izolyatsiyalangan (
agent:<agentId>:imessage:group:<chat_id>). - Agar ko‘p ishtirokchili thread
is_group=falsebilan kelsa ham, unichannels.imessage.groupsorqalichat_idbo‘yicha izolyatsiya qilishingiz mumkin (quyidagi “Group-ish threads” ga qarang).
Konfiguratsiya yozuvlari
Standart bo‘yicha iMessage/config set|unset orqali ishga tushirilgan konfiguratsiya yangilanishlarini yozishga ruxsat etilgan (commands.config: true talab etiladi).
O‘chirish:
Talablar
- Messages akkauntiga kirilgan macOS.
- OpenClaw +
imsguchun Full Disk Access (Messages DB’ga kirish). - Automation permission when sending.
channels.imessage.cliPathcan point to any command that proxies stdin/stdout (for example, a wrapper script that SSHes to another Mac and runsimsg rpc).
Troubleshooting macOS Privacy and Security TCC
If sending/receiving fails (for example,imsg rpc exits non-zero, times out, or the gateway appears to hang), a common cause is a macOS permission prompt that was never approved.
macOS grants TCC permissions per app/process context. Approve prompts in the same context that runs imsg (for example, Terminal/iTerm, a LaunchAgent session, or an SSH-launched process).
Checklist:
- Full Disk Access: allow access for the process running OpenClaw (and any shell/SSH wrapper that executes
imsg). This is required to read the Messages database (chat.db). - Automation → Messages: allow the process running OpenClaw (and/or your terminal) to control Messages.app for outbound sends.
imsgCLI health: verifyimsgis installed and supports RPC (imsg rpc --help).
Setup (fast path)
- Ensure Messages is signed in on this Mac.
- Configure iMessage and start the gateway.
Dedicated bot macOS user (for isolated identity)
If you want the bot to send from a separate iMessage identity (and keep your personal Messages clean), use a dedicated Apple ID + a dedicated macOS user.- Create a dedicated Apple ID (example:
[email protected]).- Apple may require a phone number for verification / 2FA.
- Create a macOS user (example:
openclawhome) and sign into it. - Open Messages in that macOS user and sign into iMessage using the bot Apple ID.
- Enable Remote Login (System Settings → General → Sharing → Remote Login).
- Install
imsg:brew install steipete/tap/imsg
- Set up SSH so
ssh <bot-macos-user>@localhost trueworks without a password. - Point
channels.imessage.accounts.bot.cliPathat an SSH wrapper that runsimsgas the bot user.
imsg rpc looks stuck or exits, log into that user (Screen Sharing helps), run a one-time imsg chats --limit 1 / imsg send ..., approve prompts, then retry. See Troubleshooting macOS Privacy and Security TCC.
Example wrapper (chmod +x). Replace <bot-macos-user> with your actual macOS username:
channels.imessage.cliPath, channels.imessage.dbPath) instead of the accounts map.
Remote/SSH variant (optional)
If you want iMessage on another Mac, setchannels.imessage.cliPath to a wrapper that runs imsg on the remote macOS host over SSH. OpenClaw only needs stdio.
Example wrapper:
cliPath points to a remote host via SSH, attachment paths in the Messages database reference files on the remote machine. OpenClaw can automatically fetch these over SCP by setting channels.imessage.remoteHost:
remoteHost is not set, OpenClaw attempts to auto-detect it by parsing the SSH command in your wrapper script. Explicit configuration is recommended for reliability.
Remote Mac via Tailscale (example)
If the Gateway runs on a Linux host/VM but iMessage must run on a Mac, Tailscale is the simplest bridge: the Gateway talks to the Mac over the tailnet, runsimsg via SSH, and SCPs attachments back.
- Arxitektura:
- Aniq konfiguratsiya misoli (Tailscale hostname):
- Wrapper misoli (
~/.openclaw/scripts/imsg-ssh):
- Eslatmalar:
-
- Mac Messages’ga tizimga kirgan bo‘lishi va Remote Login yoqilgan bo‘lishi kerak.
-
- SSH kalitlaridan foydalaning, shunda
ssh [email protected]buyruqi so‘rovlarsiz ishlaydi.
- SSH kalitlaridan foydalaning, shunda
-
remoteHostilovalarni SCP orqali yuklab olish uchun SSH manziliga mos bo‘lishi kerak.
- Ko‘p akkauntli qo‘llab-quvvatlash: har bir akkaunt uchun alohida konfiguratsiya va ixtiyoriy
namebilanchannels.imessage.accountsdan foydalaning. 11. Umumiy naqsh uchungateway/configurationga qarang. 12.~/.openclaw/openclaw.jsonni commit qilmang (unda ko‘pincha tokenlar bo‘ladi).
13. Kirish nazorati (DMlar + guruhlar)
- DMlar:
-
- Standart:
channels.imessage.dmPolicy = "pairing".
- Standart:
-
- Noma’lum jo‘natuvchilar pairing kodi oladi; tasdiqlanmaguncha xabarlar e’tiborga olinmaydi (kodlar 1 soatdan keyin eskiradi).
-
- Tasdiqlash:
-
openclaw pairing list imessage
-
openclaw pairing approve imessage <CODE>
-
- Pairing iMessage DMlar uchun standart token almashinuvidir. 21. Tafsilotlar: Pairing
- Guruhlar:
-
channels.imessage.groupPolicy = open | allowlist | disabled.
-
allowlisto‘rnatilganda, guruhlarda kim ishga tushira olishinichannels.imessage.groupAllowFromboshqaradi.
-
- Mention gating
agents.list[].groupChat.mentionPatterns(yokimessages.groupChat.mentionPatterns) dan foydalanadi, chunki iMessage’da native mention metama’lumotlari yo‘q.
- Mention gating
-
- Ko‘p-agent override: har bir agent uchun
agents.list[].groupChat.mentionPatternsda alohida patternlar o‘rnating.
- Ko‘p-agent override: har bir agent uchun
27. Qanday ishlaydi (xatti-harakat)
-
imsgxabar hodisalarini stream qiladi; gateway ularni umumiy kanal konvertiga normallashtiradi.
-
- Javoblar har doim o‘sha chat id yoki handle’ga qaytariladi.
30. Guruhga o‘xshash threadlar (is_group=false)
-
Ba’zi iMessage threadlarida bir nechta ishtirokchi bo‘lishi mumkin, ammo Messages chat identifikatorni qanday saqlashiga qarab
is_group=falsebilan keladi. -
Agar
channels.imessage.groupsostidachat_idni aniq sozlasangiz, OpenClaw ushbu threadni “guruh” sifatida ko‘radi:
-
- sessiya izolyatsiyasi (alohida
agent:<agentId>:imessage:group:<chat_id>sessiya kaliti)
- sessiya izolyatsiyasi (alohida
-
- guruh allowlisting / mention gating xatti-harakati
- Misol:
- Bu muayyan thread uchun alohida shaxsiyat/model kerak bo‘lganda foydalidir (qarang: Multi-agent routing). 38. Fayl tizimi izolyatsiyasi uchun Sandboxing ga qarang.
39. Media + cheklovlar
-
channels.imessage.includeAttachmentsorqali ixtiyoriy ilova (attachment) qabul qilish.
-
- Media limiti
channels.imessage.mediaMaxMborqali belgilanadi.
- Media limiti
42. Cheklovlar
-
- Chiqishdagi matn
channels.imessage.textChunkLimitga bo‘linadi (standart 4000).
- Chiqishdagi matn
-
- Ixtiyoriy yangi qator bo‘yicha bo‘lish: uzunlik bo‘yicha bo‘lishdan oldin bo‘sh qatorlar (paragraf chegaralari) bo‘yicha ajratish uchun
channels.imessage.chunkMode="newline"ni o‘rnating.
- Ixtiyoriy yangi qator bo‘yicha bo‘lish: uzunlik bo‘yicha bo‘lishdan oldin bo‘sh qatorlar (paragraf chegaralari) bo‘yicha ajratish uchun
-
- Media yuklashlari
channels.imessage.mediaMaxMbbilan cheklanadi (standart 16).
- Media yuklashlari
46. Manzillash / yetkazib berish nishonlari
- Barqaror marshrutlash uchun
chat_idni afzal ko‘ring:
-
chat_id:123(afzal)
-
chat_guid:...
-
chat_identifier:...
- direct handles:
imessage:+1555/sms:+1555/[email protected]
Configuration reference (iMessage)
Full configuration: Configuration Provider options:channels.imessage.enabled: enable/disable channel startup.channels.imessage.cliPath: path toimsg.channels.imessage.dbPath: Messages DB path.channels.imessage.remoteHost: SSH host for SCP attachment transfer whencliPathpoints to a remote Mac (e.g.,user@gateway-host). Auto-detected from SSH wrapper if not set.channels.imessage.service:imessage | sms | auto.channels.imessage.region: SMS region.channels.imessage.dmPolicy:pairing | allowlist | open | disabled(default: pairing).channels.imessage.allowFrom: DM allowlist (handles, emails, E.164 numbers, orchat_id:*).openrequires"*". iMessage has no usernames; use handles or chat targets.channels.imessage.groupPolicy:open | allowlist | disabled(default: allowlist).channels.imessage.groupAllowFrom: group sender allowlist.channels.imessage.historyLimit/channels.imessage.accounts.*.historyLimit: max group messages to include as context (0 disables).channels.imessage.dmHistoryLimit: DM history limit in user turns. Per-user overrides:channels.imessage.dms["<handle>"].historyLimit.channels.imessage.groups: per-group defaults + allowlist (use"*"for global defaults).channels.imessage.includeAttachments: ingest attachments into context.channels.imessage.mediaMaxMb: inbound/outbound media cap (MB).channels.imessage.textChunkLimit: outbound chunk size (chars).channels.imessage.chunkMode:length(default) ornewlineto split on blank lines (paragraph boundaries) before length chunking.
agents.list[].groupChat.mentionPatterns(ormessages.groupChat.mentionPatterns).messages.responsePrefix.