Community translations by veiseule.ai — Help improve them on Crowdin
Skip to main content

iMessage (لیگیسی: imsg)

سفارش کردہ: نئی iMessage سیٹ اپس کے لیے BlueBubbles استعمال کریں۔

imsg چینل ایک لیگیسی بیرونی CLI انٹیگریشن ہے اور آئندہ ریلیز میں ہٹایا جا سکتا ہے۔

Status: legacy external CLI integration. Gateway spawns imsg rpc (JSON-RPC over stdio).

فوری سیٹ اپ (مبتدی)

  1. یقینی بنائیں کہ اس Mac پر Messages میں سائن اِن ہے۔
  2. imsg انسٹال کریں: - brew install steipete/tap/imsg
  3. OpenClaw کو channels.imessage.cliPath اور channels.imessage.dbPath کے ساتھ کنفیگر کریں۔
  4. گیٹ وے شروع کریں اور macOS کے کسی بھی پرامپٹس (Automation + Full Disk Access) کی منظوری دیں۔

کم از کم کنفیگ:

{
  channels: {
    imessage: {
      enabled: true,
      cliPath: "/usr/local/bin/imsg",
      dbPath: "/Users/<you>/Library/Messages/chat.db",
    },
  },
}

یہ کیا ہے

  • macOS پر imsg پر مبنی iMessage چینل۔
  • متعین روٹنگ: جوابات ہمیشہ iMessage پر واپس جاتے ہیں۔
  • DMs ایجنٹ کے مرکزی سیشن کو شیئر کرتے ہیں؛ گروپس الگ ہوتے ہیں (agent:<agentId>:imessage:group:<chat_id>
  • اگر متعدد شرکاء والی تھریڈ is_group=false کے ساتھ آئے، تو آپ پھر بھی اسے chat_id کے ذریعے channels.imessage.groups استعمال کرتے ہوئے الگ کر سکتے ہیں (نیچے “Group-ish threads” دیکھیں)۔

کنفیگ لکھائی

بطورِ طے شدہ، iMessage کو /config set|unset کے ذریعے متحرک ہونے والی کنفیگ اپڈیٹس لکھنے کی اجازت ہے (اس کے لیے commands.config: true درکار ہے)۔

غیرفعال کرنے کے لیے:

{
  channels: { imessage: { configWrites: false } },
}

ضروریات

  • macOS جس پر Messages میں سائن اِن ہو۔
  • OpenClaw + imsg کے لیے Full Disk Access (Messages DB تک رسائی)۔
  • بھیجتے وقت Automation کی اجازت۔
  • channels.imessage.cliPath کسی بھی ایسے کمانڈ کی طرف اشارہ کر سکتا ہے جو stdin/stdout کو پراکسی کرے (مثلاً ایک ریپر اسکرپٹ جو SSH کے ذریعے دوسرے Mac سے جڑ کر imsg rpc چلاتا ہے)۔

macOS Privacy and Security TCC کی خرابیوں کا ازالہ

اگر بھیجنا/وصول کرنا ناکام ہو (مثلاً imsg rpc نان زیرو کے ساتھ ختم ہو جائے، ٹائم آؤٹ ہو، یا گیٹ وے ہینگ ہوتا نظر آئے)، تو ایک عام وجہ macOS کی اجازت کا پرامپٹ ہوتا ہے جسے کبھی منظور نہیں کیا گیا۔

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).

چیک لسٹ:

  • 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: آؤٹ باؤنڈ بھیجنے کے لیے OpenClaw چلانے والے پروسیس (اور/یا آپ کے ٹرمینل) کو Messages.app کنٹرول کرنے کی اجازت دیں۔
  • imsg CLI صحت: تصدیق کریں کہ imsg انسٹال ہے اور RPC (imsg rpc --help) کو سپورٹ کرتا ہے۔

Tip: If OpenClaw is running headless (LaunchAgent/systemd/SSH) the macOS prompt can be easy to miss. Run a one-time interactive command in a GUI terminal to force the prompt, then retry:

imsg chats --limit 1
# or
imsg send <handle> "test"

متعلقہ macOS فولڈر اجازتیں (Desktop/Documents/Downloads): /platforms/mac/permissions۔

سیٹ اپ (فاسٹ پاتھ)

  1. یقینی بنائیں کہ اس Mac پر Messages میں سائن اِن ہے۔
  2. iMessage کنفیگر کریں اور گیٹ وے شروع کریں۔

مخصوص بوٹ macOS صارف (شناخت کی علیحدگی کے لیے)

اگر آپ چاہتے ہیں کہ بوٹ علیحدہ iMessage شناخت سے بھیجے (اور آپ کے ذاتی Messages صاف رہیں)، تو ایک مخصوص Apple ID + ایک مخصوص macOS صارف استعمال کریں۔

  1. ایک مخصوص Apple ID بنائیں (مثال: my-cool-bot@icloud.com)۔ - Apple توثیق / 2FA کے لیے فون نمبر مانگ سکتا ہے۔
  2. ایک macOS صارف بنائیں (مثال: openclawhome) اور اس میں سائن اِن کریں۔
  3. اسی macOS صارف میں Messages کھولیں اور بوٹ Apple ID سے iMessage میں سائن اِن کریں۔
  4. Remote Login فعال کریں (System Settings → General → Sharing → Remote Login)۔
  5. imsg انسٹال کریں: - brew install steipete/tap/imsg
  6. SSH اس طرح سیٹ اپ کریں کہ ssh <bot-macos-user>@localhost true بغیر پاس ورڈ کے کام کرے۔
  7. channels.imessage.accounts.bot.cliPath کو ایسے SSH ریپر کی طرف پوائنٹ کریں جو بوٹ صارف کے طور پر imsg چلائے۔

First-run note: sending/receiving may require GUI approvals (Automation + Full Disk Access) in the bot macOS user. If 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:

#!/usr/bin/env bash
set -euo pipefail

# Run an interactive SSH once first to accept host keys:
#   ssh <bot-macos-user>@localhost true
exec /usr/bin/ssh -o BatchMode=yes -o ConnectTimeout=5 -T <bot-macos-user>@localhost \
  "/usr/local/bin/imsg" "$@"

مثالی کنفیگ:

{
  channels: {
    imessage: {
      enabled: true,
      accounts: {
        bot: {
          name: "Bot",
          enabled: true,
          cliPath: "/path/to/imsg-bot",
          dbPath: "/Users/<bot-macos-user>/Library/Messages/chat.db",
        },
      },
    },
  },
}

سنگل اکاؤنٹ سیٹ اپس کے لیے، accounts میپ کے بجائے فلیٹ آپشنز (channels.imessage.cliPath، channels.imessage.dbPath) استعمال کریں۔

ریموٹ/SSH ویریئنٹ (اختیاری)

If you want iMessage on another Mac, set channels.imessage.cliPath to a wrapper that runs imsg on the remote macOS host over SSH. OpenClaw only needs stdio.

مثالی ریپر:

#!/usr/bin/env bash
exec ssh -T gateway-host imsg "$@"

Remote attachments: When 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:

{
  channels: {
    imessage: {
      cliPath: "~/imsg-ssh", // SSH wrapper to remote Mac
      remoteHost: "user@gateway-host", // for SCP file transfer
      includeAttachments: true,
    },
  },
}

If 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.

Tailscale کے ذریعے ریموٹ Mac (مثال)

اگر Gateway لینکس ہوسٹ/VM پر چل رہا ہو لیکن iMessage کو Mac پر چلنا ضروری ہو، تو Tailscale سب سے آسان پل ہے: Gateway ٹیل نیٹ کے ذریعے Mac سے بات کرتا ہے، SSH کے ذریعے imsg چلاتا ہے، اور اٹیچمنٹس SCP کے ذریعے واپس لاتا ہے۔

آرکیٹیکچر:

%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#ffffff',
    'primaryTextColor': '#000000',
    'primaryBorderColor': '#000000',
    'lineColor': '#000000',
    'secondaryColor': '#f9f9fb',
    'tertiaryColor': '#ffffff',
    'clusterBkg': '#f9f9fb',
    'clusterBorder': '#000000',
    'nodeBorder': '#000000',
    'mainBkg': '#ffffff',
    'edgeLabelBackground': '#ffffff'
  }
}}%%
flowchart TB
 subgraph T[" "]
 subgraph Tailscale[" "]
    direction LR
      Gateway["<b>Gateway host (Linux/VM)<br></b><br>openclaw gateway<br>channels.imessage.cliPath"]
      Mac["<b>Mac with Messages + imsg<br></b><br>Messages signed in<br>Remote Login enabled"]
  end
    Gateway -- SSH (imsg rpc) --> Mac
    Mac -- SCP (attachments) --> Gateway
    direction BT
    User["user@gateway-host"] -- "Tailscale tailnet (hostname or 100.x.y.z)" --> Gateway
end

ٹھوس کنفیگ مثال (Tailscale ہوسٹ نیم):

{
  channels: {
    imessage: {
      enabled: true,
      cliPath: "~/.openclaw/scripts/imsg-ssh",
      remoteHost: "bot@mac-mini.tailnet-1234.ts.net",
      includeAttachments: true,
      dbPath: "/Users/bot/Library/Messages/chat.db",
    },
  },
}

مثالی ریپر (~/.openclaw/scripts/imsg-ssh):

#!/usr/bin/env bash
exec ssh -T bot@mac-mini.tailnet-1234.ts.net imsg "$@"

نوٹس:

  • یقینی بنائیں کہ Mac پر Messages میں سائن اِن ہے، اور Remote Login فعال ہے۔
  • SSH کیز استعمال کریں تاکہ ssh bot@mac-mini.tailnet-1234.ts.net بغیر پرامپٹس کے کام کرے۔
  • remoteHost کو SSH ٹارگٹ سے میل کھانا چاہیے تاکہ SCP اٹیچمنٹس حاصل کر سکے۔

Multi-account support: use channels.imessage.accounts with per-account config and optional name. See gateway/configuration for the shared pattern. Don't commit ~/.openclaw/openclaw.json (it often contains tokens).

رسائی کا کنٹرول (DMs + گروپس)

DMs:

  • ڈیفالٹ: channels.imessage.dmPolicy = "pairing"۔
  • نامعلوم بھیجنے والوں کو جوڑی بنانے کا کوڈ ملتا ہے؛ منظوری تک پیغامات نظرانداز کیے جاتے ہیں (کوڈز 1 گھنٹے بعد ختم ہو جاتے ہیں)۔
  • منظوری دیں بذریعہ:
  • openclaw pairing list imessage
  • openclaw pairing approve imessage <CODE>
  • Pairing is the default token exchange for iMessage DMs. Details: Pairing

گروپس:

  • channels.imessage.groupPolicy = open | allowlist | disabled۔
  • channels.imessage.groupAllowFrom کنٹرول کرتا ہے کہ جب allowlist سیٹ ہو تو گروپس میں کون ٹرگر کر سکتا ہے۔
  • میشن گیٹنگ agents.list[].groupChat.mentionPatterns (یا messages.groupChat.mentionPatterns) استعمال کرتی ہے کیونکہ iMessage میں نیٹو میشن میٹاڈیٹا نہیں ہوتا۔
  • ملٹی ایجنٹ اووررائیڈ: agents.list[].groupChat.mentionPatterns پر فی ایجنٹ پیٹرنز سیٹ کریں۔

یہ کیسے کام کرتا ہے (رویّہ)

  • imsg پیغام کے واقعات کو اسٹریم کرتا ہے؛ گیٹ وے انہیں مشترکہ چینل اینویلپ میں نارملائز کرتا ہے۔
  • جوابات ہمیشہ اسی چیٹ آئی ڈی یا ہینڈل پر واپس جاتے ہیں۔

Group-ish تھریڈز (is_group=false)

کچھ iMessage تھریڈز میں متعدد شرکاء ہو سکتے ہیں لیکن Messages کے چیٹ شناخت کنندہ کو محفوظ کرنے کے طریقے کے مطابق وہ is_group=false کے ساتھ آ سکتے ہیں۔

اگر آپ channels.imessage.groups کے تحت واضح طور پر chat_id کنفیگر کریں، تو OpenClaw اس تھریڈ کو درج ذیل کے لیے “گروپ” سمجھتا ہے:

  • سیشن آئسولیشن (علیحدہ agent:<agentId>:imessage:group:<chat_id> سیشن کلید)
  • گروپ اجازت فہرست / میشن گیٹنگ رویّہ

مثال:

{
  channels: {
    imessage: {
      groupPolicy: "allowlist",
      groupAllowFrom: ["+15555550123"],
      groups: {
        "42": { requireMention: false },
      },
    },
  },
}

This is useful when you want an isolated personality/model for a specific thread (see Multi-agent routing). For filesystem isolation, see Sandboxing.

میڈیا + حدود

  • اختیاری اٹیچمنٹ انجیسشن بذریعہ channels.imessage.includeAttachments۔
  • میڈیا حد بذریعہ channels.imessage.mediaMaxMb۔

حدود

  • آؤٹ باؤنڈ متن کو channels.imessage.textChunkLimit (ڈیفالٹ 4000) پر چنکس میں تقسیم کیا جاتا ہے۔
  • اختیاری نئی لائن چنکنگ: channels.imessage.chunkMode="newline" سیٹ کریں تاکہ لمبائی کے مطابق چنکنگ سے پہلے خالی لائنوں (پیراگراف حدود) پر تقسیم ہو۔
  • میڈیا اپ لوڈز channels.imessage.mediaMaxMb (ڈیفالٹ 16) سے محدود ہیں۔

ایڈریسنگ / ڈیلیوری ٹارگٹس

مستحکم روٹنگ کے لیے chat_id کو ترجیح دیں:

  • chat_id:123 (ترجیحی)
  • chat_guid:...
  • chat_identifier:...
  • براہِ راست ہینڈلز: imessage:+1555 / sms:+1555 / user@example.com

چیٹس کی فہرست:

imsg chats --limit 20

کنفیگریشن ریفرنس (iMessage)

مکمل کنفیگریشن: Configuration

فراہم کنندہ کے اختیارات:

  • channels.imessage.enabled: چینل اسٹارٹ اپ کو فعال/غیرفعال کریں۔
  • channels.imessage.cliPath: imsg کا پاتھ۔
  • channels.imessage.dbPath: Messages DB کا پاتھ۔
  • channels.imessage.remoteHost: SSH host for SCP attachment transfer when cliPath points 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 ریجن۔
  • channels.imessage.dmPolicy: pairing | allowlist | open | disabled (ڈیفالٹ: pairing)۔
  • channels.imessage.allowFrom: DM allowlist (handles, emails, E.164 numbers, or chat_id:*). open requires "*". iMessage has no usernames; use handles or chat targets.
  • channels.imessage.groupPolicy: open | allowlist | disabled (ڈیفالٹ: allowlist)۔
  • channels.imessage.groupAllowFrom: گروپ بھیجنے والوں کی اجازت فہرست۔
  • channels.imessage.historyLimit / channels.imessage.accounts.*.historyLimit: سیاق میں شامل کرنے کے لیے زیادہ سے زیادہ گروپ پیغامات (0 غیرفعال کرتا ہے)۔
  • channels.imessage.dmHistoryLimit: DM history limit in user turns. Per-user overrides: channels.imessage.dms["<handle>"].historyLimit.
  • channels.imessage.groups: فی گروپ ڈیفالٹس + اجازت فہرست (عالمی ڈیفالٹس کے لیے "*" استعمال کریں)۔
  • channels.imessage.includeAttachments: اٹیچمنٹس کو سیاق میں شامل کریں۔
  • channels.imessage.mediaMaxMb: اِن باؤنڈ/آؤٹ باؤنڈ میڈیا حد (MB)۔
  • channels.imessage.textChunkLimit: آؤٹ باؤنڈ چنک سائز (حروف)۔
  • channels.imessage.chunkMode: length (ڈیفالٹ) یا newline تاکہ لمبائی کے مطابق چنکنگ سے پہلے خالی لائنوں (پیراگراف حدود) پر تقسیم ہو۔

متعلقہ عالمی اختیارات:

  • agents.list[].groupChat.mentionPatterns (یا messages.groupChat.mentionPatterns
  • messages.responsePrefix۔