agent-messenger 2.27.1 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/README.md +11 -1
- package/.claude-plugin/marketplace.json +14 -1
- package/.claude-plugin/plugin.json +4 -2
- package/AGENTS.md +4 -0
- package/README.md +40 -9
- package/dist/package.json +10 -2
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/discordbot/cli.js +1 -1
- package/dist/src/platforms/imessage/cli.d.ts +5 -0
- package/dist/src/platforms/imessage/cli.d.ts.map +1 -0
- package/dist/src/platforms/imessage/cli.js +31 -0
- package/dist/src/platforms/imessage/cli.js.map +1 -0
- package/dist/src/platforms/imessage/client.d.ts +43 -0
- package/dist/src/platforms/imessage/client.d.ts.map +1 -0
- package/dist/src/platforms/imessage/client.js +190 -0
- package/dist/src/platforms/imessage/client.js.map +1 -0
- package/dist/src/platforms/imessage/commands/auth.d.ts +31 -0
- package/dist/src/platforms/imessage/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/auth.js +100 -0
- package/dist/src/platforms/imessage/commands/auth.js.map +1 -0
- package/dist/src/platforms/imessage/commands/chat.d.ts +3 -0
- package/dist/src/platforms/imessage/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/chat.js +42 -0
- package/dist/src/platforms/imessage/commands/chat.js.map +1 -0
- package/dist/src/platforms/imessage/commands/doctor.d.ts +25 -0
- package/dist/src/platforms/imessage/commands/doctor.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/doctor.js +101 -0
- package/dist/src/platforms/imessage/commands/doctor.js.map +1 -0
- package/dist/src/platforms/imessage/commands/index.d.ts +7 -0
- package/dist/src/platforms/imessage/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/index.js +7 -0
- package/dist/src/platforms/imessage/commands/index.js.map +1 -0
- package/dist/src/platforms/imessage/commands/message.d.ts +5 -0
- package/dist/src/platforms/imessage/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/message.js +127 -0
- package/dist/src/platforms/imessage/commands/message.js.map +1 -0
- package/dist/src/platforms/imessage/commands/setup.d.ts +20 -0
- package/dist/src/platforms/imessage/commands/setup.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/setup.js +57 -0
- package/dist/src/platforms/imessage/commands/setup.js.map +1 -0
- package/dist/src/platforms/imessage/commands/shared.d.ts +10 -0
- package/dist/src/platforms/imessage/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/shared.js +53 -0
- package/dist/src/platforms/imessage/commands/shared.js.map +1 -0
- package/dist/src/platforms/imessage/commands/whoami.d.ts +3 -0
- package/dist/src/platforms/imessage/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/imessage/commands/whoami.js +20 -0
- package/dist/src/platforms/imessage/commands/whoami.js.map +1 -0
- package/dist/src/platforms/imessage/credential-manager.d.ts +22 -0
- package/dist/src/platforms/imessage/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/imessage/credential-manager.js +111 -0
- package/dist/src/platforms/imessage/credential-manager.js.map +1 -0
- package/dist/src/platforms/imessage/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/imessage/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/imessage/ensure-auth.js +13 -0
- package/dist/src/platforms/imessage/ensure-auth.js.map +1 -0
- package/dist/src/platforms/imessage/errors.d.ts +3 -0
- package/dist/src/platforms/imessage/errors.d.ts.map +1 -0
- package/dist/src/platforms/imessage/errors.js +25 -0
- package/dist/src/platforms/imessage/errors.js.map +1 -0
- package/dist/src/platforms/imessage/index.d.ts +7 -0
- package/dist/src/platforms/imessage/index.d.ts.map +1 -0
- package/dist/src/platforms/imessage/index.js +5 -0
- package/dist/src/platforms/imessage/index.js.map +1 -0
- package/dist/src/platforms/imessage/rpc.d.ts +20 -0
- package/dist/src/platforms/imessage/rpc.d.ts.map +1 -0
- package/dist/src/platforms/imessage/rpc.js +133 -0
- package/dist/src/platforms/imessage/rpc.js.map +1 -0
- package/dist/src/platforms/imessage/types.d.ts +59 -0
- package/dist/src/platforms/imessage/types.d.ts.map +1 -0
- package/dist/src/platforms/imessage/types.js +29 -0
- package/dist/src/platforms/imessage/types.js.map +1 -0
- package/dist/src/platforms/instagram/cli.js +1 -1
- package/dist/src/platforms/instagram/client.d.ts +6 -1
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +17 -0
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/hybrid-listener.d.ts +48 -0
- package/dist/src/platforms/instagram/hybrid-listener.d.ts.map +1 -0
- package/dist/src/platforms/instagram/hybrid-listener.js +154 -0
- package/dist/src/platforms/instagram/hybrid-listener.js.map +1 -0
- package/dist/src/platforms/instagram/index.d.ts +2 -0
- package/dist/src/platforms/instagram/index.d.ts.map +1 -1
- package/dist/src/platforms/instagram/index.js +2 -0
- package/dist/src/platforms/instagram/index.js.map +1 -1
- package/dist/src/platforms/instagram/mqtt/connection.d.ts +4 -0
- package/dist/src/platforms/instagram/mqtt/connection.d.ts.map +1 -0
- package/dist/src/platforms/instagram/mqtt/connection.js +66 -0
- package/dist/src/platforms/instagram/mqtt/connection.js.map +1 -0
- package/dist/src/platforms/instagram/mqtt/thrift.d.ts +22 -0
- package/dist/src/platforms/instagram/mqtt/thrift.d.ts.map +1 -0
- package/dist/src/platforms/instagram/mqtt/thrift.js +143 -0
- package/dist/src/platforms/instagram/mqtt/thrift.js.map +1 -0
- package/dist/src/platforms/instagram/mqtt/transport.d.ts +42 -0
- package/dist/src/platforms/instagram/mqtt/transport.d.ts.map +1 -0
- package/dist/src/platforms/instagram/mqtt/transport.js +246 -0
- package/dist/src/platforms/instagram/mqtt/transport.js.map +1 -0
- package/dist/src/platforms/instagram/realtime-listener.d.ts +33 -0
- package/dist/src/platforms/instagram/realtime-listener.d.ts.map +1 -0
- package/dist/src/platforms/instagram/realtime-listener.js +151 -0
- package/dist/src/platforms/instagram/realtime-listener.js.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.js +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +4 -4
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/line/cli.js +1 -1
- package/dist/src/platforms/webex/cli.js +1 -1
- package/dist/src/platforms/webexbot/cli.js +1 -1
- package/dist/src/platforms/wechatbot/cli.js +1 -1
- package/dist/src/platforms/whatsapp/cli.js +1 -1
- package/dist/src/platforms/whatsappbot/cli.js +1 -1
- package/dist/src/tui/adapters/imessage-adapter.d.ts +21 -0
- package/dist/src/tui/adapters/imessage-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/imessage-adapter.js +110 -0
- package/dist/src/tui/adapters/imessage-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +9 -0
- package/dist/src/tui/app.js.map +1 -1
- package/docs/content/docs/agent-skills.mdx +1 -1
- package/docs/content/docs/cli/imessage.mdx +99 -0
- package/docs/content/docs/cli/instagram.mdx +1 -1
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/index.mdx +9 -6
- package/docs/content/docs/quick-start.mdx +2 -0
- package/docs/content/docs/sdk/instagram.mdx +90 -5
- package/docs/content/docs/tui.mdx +4 -3
- package/package.json +10 -2
- package/scripts/postbuild.ts +12 -15
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-imessage/SKILL.md +133 -0
- package/skills/agent-imessage/references/authentication.md +66 -0
- package/skills/agent-imessage/references/permissions.md +31 -0
- package/skills/agent-imessage/references/setup.md +49 -0
- package/skills/agent-instagram/SKILL.md +72 -2
- package/skills/agent-instagram/references/common-patterns.md +36 -0
- package/skills/agent-instagram/templates/monitor-chat.sh +5 -0
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-telegrambot/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +1 -1
- package/skills/agent-webexbot/SKILL.md +1 -1
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/cli.ts +4 -0
- package/src/platforms/imessage/cli.ts +39 -0
- package/src/platforms/imessage/client.test.ts +137 -0
- package/src/platforms/imessage/client.ts +253 -0
- package/src/platforms/imessage/commands/auth.ts +142 -0
- package/src/platforms/imessage/commands/chat.ts +51 -0
- package/src/platforms/imessage/commands/doctor.test.ts +80 -0
- package/src/platforms/imessage/commands/doctor.ts +139 -0
- package/src/platforms/imessage/commands/index.ts +6 -0
- package/src/platforms/imessage/commands/message.test.ts +20 -0
- package/src/platforms/imessage/commands/message.ts +151 -0
- package/src/platforms/imessage/commands/setup.test.ts +52 -0
- package/src/platforms/imessage/commands/setup.ts +76 -0
- package/src/platforms/imessage/commands/shared.test.ts +19 -0
- package/src/platforms/imessage/commands/shared.ts +69 -0
- package/src/platforms/imessage/commands/whoami.ts +22 -0
- package/src/platforms/imessage/credential-manager.test.ts +122 -0
- package/src/platforms/imessage/credential-manager.ts +123 -0
- package/src/platforms/imessage/ensure-auth.ts +18 -0
- package/src/platforms/imessage/errors.ts +27 -0
- package/src/platforms/imessage/index.test.ts +13 -0
- package/src/platforms/imessage/index.ts +16 -0
- package/src/platforms/imessage/rpc.ts +157 -0
- package/src/platforms/imessage/test-stub-imsg.mjs +147 -0
- package/src/platforms/imessage/types.test.ts +47 -0
- package/src/platforms/imessage/types.ts +95 -0
- package/src/platforms/instagram/client.ts +23 -0
- package/src/platforms/instagram/hybrid-listener.test.ts +135 -0
- package/src/platforms/instagram/hybrid-listener.ts +196 -0
- package/src/platforms/instagram/index.ts +10 -0
- package/src/platforms/instagram/mqtt/connection.ts +72 -0
- package/src/platforms/instagram/mqtt/thrift.test.ts +91 -0
- package/src/platforms/instagram/mqtt/thrift.ts +159 -0
- package/src/platforms/instagram/mqtt/transport.ts +285 -0
- package/src/platforms/instagram/realtime-listener.test.ts +34 -0
- package/src/platforms/instagram/realtime-listener.ts +201 -0
- package/src/platforms/kakaotalk/client.test.ts +40 -0
- package/src/platforms/kakaotalk/client.ts +6 -4
- package/src/platforms/webexbot/cli.ts +0 -0
- package/src/tui/adapters/imessage-adapter.ts +131 -0
- package/src/tui/app.ts +13 -0
|
@@ -4,7 +4,7 @@ description: Teach your AI agent how to use Agent Messenger CLIs effectively.
|
|
|
4
4
|
icon: Hexagon
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Agent Skills are instruction files that teach AI coding agents how to use tools effectively. Agent Messenger includes skills for Slack, Discord, Teams, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, and Channel Talk (beta).
|
|
7
|
+
Agent Skills are instruction files that teach AI coding agents how to use tools effectively. Agent Messenger includes skills for Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, iMessage (Mac-only), Instagram, KakaoTalk, and Channel Talk (beta).
|
|
8
8
|
|
|
9
9
|
## What Are Agent Skills?
|
|
10
10
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: iMessage
|
|
3
|
+
description: Complete reference for the agent-imessage CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **Tip**: After `npm install -g agent-messenger`, `agent-imessage` is available directly. For one-off execution without a global install you can use `npm exec --package agent-messenger agent-imessage ...`, `pnpm dlx --package agent-messenger agent-imessage ...`, `yarn dlx agent-messenger agent-imessage ...`, or `bunx --package agent-messenger agent-imessage ...`.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
Apple provides no public iMessage API, so `agent-imessage` runs **on a Mac** and drives Messages through [imsg](https://github.com/openclaw/imsg), a native Swift CLI:
|
|
11
|
+
|
|
12
|
+
- The agent must run **on the Mac itself** — imsg is local-only (no network, no server).
|
|
13
|
+
- `agent-imessage` spawns `imsg` and communicates over JSON-RPC (stdin/stdout).
|
|
14
|
+
- Requires macOS 14+, imsg installed (`brew install steipete/tap/imsg`), **Full Disk Access** (read), and **Automation → Messages** (send). macOS grants these to the launching parent process.
|
|
15
|
+
- Basic send/read/watch/standard tapbacks need **no SIP changes**. Typing, edit/unsend, group management, and targeted/custom reactions require imsg's bridge (`imsg launch` + SIP) and are a later tier.
|
|
16
|
+
|
|
17
|
+
See the [setup guide](https://github.com/agent-messenger/agent-messenger/blob/main/skills/agent-imessage/references/setup.md) and [permissions guide](https://github.com/agent-messenger/agent-messenger/blob/main/skills/agent-imessage/references/permissions.md).
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
agent-imessage setup # guided check + save account
|
|
23
|
+
agent-imessage doctor # diagnose imsg + permissions
|
|
24
|
+
|
|
25
|
+
agent-imessage chat list # chat ids/guids
|
|
26
|
+
agent-imessage message send 42 "Hello"
|
|
27
|
+
agent-imessage message send "+15551234567" "Hi"
|
|
28
|
+
agent-imessage message list 42 --limit 20
|
|
29
|
+
agent-imessage message watch --chat all --jsonl
|
|
30
|
+
agent-imessage message react 42 love
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Chat references
|
|
34
|
+
|
|
35
|
+
What a `<chat>` argument accepts depends on the command:
|
|
36
|
+
|
|
37
|
+
- **`message send`** — a **chat id** (integer rowid), a portable **guid/identifier** (e.g. `iMessage;-;+15551234567`, passed straight through to imsg), or a **phone/email recipient**.
|
|
38
|
+
- **`message list` / `message react` / `message watch --chat`** — a **chat id** is recommended. A guid/identifier also works as a convenience, but since imsg exposes no guid→id lookup it is resolved by scanning the **1000 most recent chats**; an older chat outside that window returns `chat_not_found`. Use the numeric chat id from `chat list` for those.
|
|
39
|
+
|
|
40
|
+
Get chat ids and guids from `agent-imessage chat list`.
|
|
41
|
+
|
|
42
|
+
## Authentication
|
|
43
|
+
|
|
44
|
+
iMessage uses macOS permissions, not tokens. Configure the imsg binary/region:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
agent-imessage auth set --bin /opt/homebrew/bin/imsg --region US --current
|
|
48
|
+
agent-imessage auth list
|
|
49
|
+
agent-imessage auth use <account-id>
|
|
50
|
+
agent-imessage auth remove <account-id>
|
|
51
|
+
agent-imessage auth logout
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Environment overrides (runtime only, never persisted): `AGENT_IMESSAGE_BIN`, `AGENT_IMESSAGE_REGION`.
|
|
55
|
+
|
|
56
|
+
## Commands
|
|
57
|
+
|
|
58
|
+
### chat
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
agent-imessage chat list [--limit <n>]
|
|
62
|
+
agent-imessage chat search <query> [--limit <n>]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### message
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
agent-imessage message list <chat> [--limit <n>] [--start <iso>]
|
|
69
|
+
agent-imessage message send <chat> <text>
|
|
70
|
+
agent-imessage message react <chat> <love|like|dislike|laugh|emphasis|question>
|
|
71
|
+
agent-imessage message watch [--chat <ref|all>] [--since-rowid <n>] [--jsonl]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`message react` reacts to the **most recent incoming message** in the chat (an imsg limitation without the bridge). `message watch` streams new messages; pass `--since-rowid` to replay from a message rowid then continue live.
|
|
75
|
+
|
|
76
|
+
### whoami / doctor / setup
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
agent-imessage whoami
|
|
80
|
+
agent-imessage doctor [--account <id>] [--test-chat <chatId>]
|
|
81
|
+
agent-imessage setup
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
All commands accept `--account <id>` and `--pretty`.
|
|
85
|
+
|
|
86
|
+
## Output Format
|
|
87
|
+
|
|
88
|
+
JSON by default; `--pretty` for indented output. `message watch --jsonl` emits one JSON object per line.
|
|
89
|
+
|
|
90
|
+
## Feature Tiers
|
|
91
|
+
|
|
92
|
+
| Feature | Available | Requires |
|
|
93
|
+
| ----------------------------------------------------------- | :--------: | --------------------------------- |
|
|
94
|
+
| List/search chats, send text, read/watch, standard tapbacks | ✅ | imsg core (no SIP) |
|
|
95
|
+
| Targeted/custom reactions, typing, edit/unsend, group mgmt | ⏳ planned | imsg bridge (`imsg launch` + SIP) |
|
|
96
|
+
|
|
97
|
+
## Notes
|
|
98
|
+
|
|
99
|
+
`agent-imessage` is backend-agnostic by design (the credential record carries a `provider` field). Today the only provider is the local imsg tool. Networked backends are intentionally out of scope for this on-Mac integration.
|
|
@@ -182,7 +182,7 @@ Thread IDs are numeric strings returned by `chat list` (e.g. `340282366841710300
|
|
|
182
182
|
|
|
183
183
|
## Limitations
|
|
184
184
|
|
|
185
|
-
- **HTTP on demand**: Each command makes HTTP requests and returns. No persistent daemon or WebSocket connection.
|
|
185
|
+
- **HTTP on demand**: Each command makes HTTP requests and returns. No persistent daemon or WebSocket connection. The CLI does not expose real-time events, but the SDK does — via `InstagramHybridListener` (realtime over MQTToT with polling fallback) and `InstagramRealtimeListener`. See the [SDK reference](../sdk/instagram#real-time-events).
|
|
186
186
|
- **Ban risk**: Instagram monitors for automated behavior. Avoid high-volume messaging, rapid-fire sends, or bulk operations. Space out commands when sending multiple messages.
|
|
187
187
|
- **No file uploads or downloads**
|
|
188
188
|
- **No voice or video calls**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: What is Agent Messenger?
|
|
3
|
-
description: Give your AI agent the power to read and send messages across Slack, Discord, Teams, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk, and more
|
|
3
|
+
description: Give your AI agent the power to read and send messages across Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, iMessage, Instagram, KakaoTalk, Channel Talk, and more
|
|
4
4
|
icon: Info
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Agent Messenger is a unified, agent-friendly CLI for messaging platforms.
|
|
7
|
+
Agent Messenger is a unified, agent-friendly CLI for messaging platforms. Most platforms use zero-config credential extraction from your desktop apps or quick local auth—no OAuth flows, no API keys, no admin approval needed. Supports Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, iMessage (Mac-only via imsg setup), Instagram, KakaoTalk, and Channel Talk (beta).
|
|
8
8
|
|
|
9
9
|
## Why Agent Messenger?
|
|
10
10
|
|
|
@@ -12,14 +12,14 @@ Messaging platforms only offer Bot tokens for API access—your AI agent can nev
|
|
|
12
12
|
|
|
13
13
|
- **Act as yourself, not a bot** — Extracted user tokens let your agent operate on your behalf
|
|
14
14
|
- **No API keys needed** — Automatically extracts credentials from your installed desktop apps
|
|
15
|
-
- **One interface, multiple platforms** — Learn once, use everywhere (Slack, Discord, Teams, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk)
|
|
15
|
+
- **One interface, multiple platforms** — Learn once, use everywhere (Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, iMessage, Instagram, KakaoTalk, Channel Talk)
|
|
16
16
|
- **AI-agent friendly** — JSON output by default, perfect for LLM tool use
|
|
17
17
|
- **Human friendly too** — Add `--pretty` for readable output
|
|
18
18
|
- **Token efficient** — CLI, not MCP. Load only what you need
|
|
19
19
|
|
|
20
20
|
## How It Works
|
|
21
21
|
|
|
22
|
-
Agent Messenger reads authentication tokens directly from your installed desktop apps (Slack, Discord, Teams, KakaoTalk, Channel Talk). Telegram uses TDLib with auto-provisioned API credentials. WhatsApp authenticates via pairing code. KakaoTalk supports both credential extraction and sub-device login. These apps store session tokens locally, and Agent Messenger safely extracts them.
|
|
22
|
+
Agent Messenger reads authentication tokens directly from your installed desktop apps (Slack, Discord, Teams, KakaoTalk, Channel Talk). Telegram uses TDLib with auto-provisioned API credentials. WhatsApp authenticates via pairing code. KakaoTalk supports both credential extraction and sub-device login. iMessage is the exception — Apple has no API, so it runs locally on a Mac via the [imsg](https://github.com/openclaw/imsg) tool. These apps store session tokens locally, and Agent Messenger safely extracts them.
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
# Extract credentials from Slack desktop app
|
|
@@ -36,7 +36,7 @@ No app creation. No admin approval. No waiting.
|
|
|
36
36
|
| Feature | Description |
|
|
37
37
|
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
38
38
|
| **Auto-extraction** | Pulls tokens from desktop apps automatically |
|
|
39
|
-
| **Multi-platform** | Slack, Discord, Microsoft Teams, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, and Channel Talk (beta)
|
|
39
|
+
| **Multi-platform** | Slack, Discord, Microsoft Teams, Webex, Telegram, WhatsApp, LINE, iMessage (Mac-only), Instagram, KakaoTalk, and Channel Talk (beta) |
|
|
40
40
|
| **Multi-workspace** | Switch between workspaces/servers easily |
|
|
41
41
|
| **JSON output** | Machine-readable by default, `--pretty` for humans |
|
|
42
42
|
| **Comprehensive** | Messages, channels, users, reactions, files |
|
|
@@ -95,7 +95,7 @@ Default output is JSON for machines. Add `--pretty` for humans. Both are first-c
|
|
|
95
95
|
|
|
96
96
|
### Unified Interface
|
|
97
97
|
|
|
98
|
-
Learn once, use everywhere. The same commands work across Slack, Discord, Teams, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, and Channel Talk.
|
|
98
|
+
Learn once, use everywhere. The same commands work across Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, iMessage, Instagram, KakaoTalk, and Channel Talk.
|
|
99
99
|
|
|
100
100
|
### Fail Fast, Fail Clear
|
|
101
101
|
|
|
@@ -113,11 +113,14 @@ Tokens stay on your machine. Nothing is sent to external servers. Your credentia
|
|
|
113
113
|
- [Discord](/docs/cli/discord) - Full Discord command reference
|
|
114
114
|
- [Discord Bot](/docs/cli/discordbot) - Bot token integration for server-side and CI/CD
|
|
115
115
|
- [Teams](/docs/cli/teams) - Full Teams command reference
|
|
116
|
+
- [Webex](/docs/cli/webex) - Full Webex command reference
|
|
117
|
+
- [Webex Bot](/docs/cli/webexbot) - Bot token integration for server-side and CI/CD
|
|
116
118
|
- [Telegram](/docs/cli/telegram) - TDLib setup and Telegram command reference
|
|
117
119
|
- [Telegram Bot](/docs/cli/telegrambot) - Bot token integration for server-side and CI/CD
|
|
118
120
|
- [WhatsApp](/docs/cli/whatsapp) - Full WhatsApp command reference
|
|
119
121
|
- [WhatsApp Bot](/docs/cli/whatsappbot) - Cloud API integration for WhatsApp Business
|
|
120
122
|
- [LINE](/docs/cli/line) - Full LINE command reference
|
|
123
|
+
- [iMessage](/docs/cli/imessage) - iMessage on a Mac via the imsg tool
|
|
121
124
|
- [Instagram](/docs/cli/instagram) - Instagram DM integration via private mobile API
|
|
122
125
|
- [KakaoTalk](/docs/cli/kakaotalk) - Full KakaoTalk command reference
|
|
123
126
|
- [Channel Talk](/docs/cli/channeltalk) - Full Channel Talk command reference (beta)
|
|
@@ -35,6 +35,7 @@ This installs these CLI tools:
|
|
|
35
35
|
- `agent-whatsapp` — WhatsApp CLI (user account via Baileys, pairing code auth)
|
|
36
36
|
- `agent-whatsappbot` — WhatsApp Bot CLI (Cloud API, for server-side/CI/CD)
|
|
37
37
|
- `agent-line` — LINE CLI (QR code login, Thrift protocol)
|
|
38
|
+
- `agent-imessage` — iMessage CLI (runs on a Mac via the [imsg](https://github.com/openclaw/imsg) tool)
|
|
38
39
|
- `agent-instagram` — Instagram DM CLI (user account via private mobile API)
|
|
39
40
|
- `agent-kakaotalk` — KakaoTalk CLI (sub-device login, LOCO protocol)
|
|
40
41
|
- `agent-channeltalk` — Channel Talk CLI (beta, zero-config, extracted cookies)
|
|
@@ -127,6 +128,7 @@ agent-slack workspace current
|
|
|
127
128
|
- [Telegram Bot Reference](/docs/cli/telegrambot) - Bot token for server-side/CI/CD
|
|
128
129
|
- [WhatsApp Reference](/docs/cli/whatsapp) - Full command reference
|
|
129
130
|
- [WhatsApp Bot Reference](/docs/cli/whatsappbot) - Cloud API for WhatsApp Business
|
|
131
|
+
- [iMessage Reference](/docs/cli/imessage) - iMessage on a Mac via the imsg tool
|
|
130
132
|
- [KakaoTalk Reference](/docs/cli/kakaotalk) - Full command reference
|
|
131
133
|
- [Channel Talk Reference](/docs/cli/channeltalk) - Full command reference (beta)
|
|
132
134
|
- [Channel Talk Bot Reference](/docs/cli/channeltalkbot) - Bot API for Channel Talk (beta)
|
|
@@ -13,6 +13,8 @@ npm install agent-messenger
|
|
|
13
13
|
import {
|
|
14
14
|
InstagramClient,
|
|
15
15
|
InstagramListener,
|
|
16
|
+
InstagramRealtimeListener,
|
|
17
|
+
InstagramHybridListener,
|
|
16
18
|
InstagramError,
|
|
17
19
|
InstagramCredentialManager,
|
|
18
20
|
} from 'agent-messenger/instagram'
|
|
@@ -122,7 +124,83 @@ client.setDebugLog((msg) => console.error(`[debug] ${msg}`))
|
|
|
122
124
|
|
|
123
125
|
## Real-Time Events
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
### InstagramHybridListener (Recommended)
|
|
128
|
+
|
|
129
|
+
`InstagramHybridListener` tries to connect over Instagram's MQTToT transport first (a persistent TLS connection to `edge-mqtt.facebook.com` — the same protocol Instagram's own app uses). If that fails, it falls back to polling automatically and retries the realtime connection with capped exponential backoff.
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { InstagramClient, InstagramHybridListener } from 'agent-messenger/instagram'
|
|
133
|
+
|
|
134
|
+
const client = await new InstagramClient().login()
|
|
135
|
+
const listener = new InstagramHybridListener(client, {
|
|
136
|
+
pollInterval: 5000, // fallback poll interval in ms (default: 5000)
|
|
137
|
+
realtimeRetryBaseMs: 2000, // backoff base for realtime reconnect attempts
|
|
138
|
+
realtimeRetryMaxMs: 60000, // backoff cap
|
|
139
|
+
disableRealtime: false, // set true to force polling-only mode
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
listener.on('message', (msg) => {
|
|
143
|
+
console.log(`[${msg.thread_id}] ${msg.from}: ${msg.text}`)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
listener.on('connected', ({ userId, transport }) => {
|
|
147
|
+
// transport is 'realtime' or 'polling'
|
|
148
|
+
console.log(`Listening as ${userId} via ${transport}`)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
listener.on('error', (err) => console.error(err))
|
|
152
|
+
listener.on('disconnected', () => console.log('Stopped'))
|
|
153
|
+
|
|
154
|
+
await listener.start()
|
|
155
|
+
// listener.stop() to disconnect
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Events
|
|
159
|
+
|
|
160
|
+
| Event | Payload | Description |
|
|
161
|
+
| -------------- | -------------------------------------------------------- | --------------------------------------------- |
|
|
162
|
+
| `message` | `InstagramMessageSummary` | New message received |
|
|
163
|
+
| `connected` | `{ userId: string; transport: 'realtime' \| 'polling' }` | Listener active; `transport` shows which path |
|
|
164
|
+
| `disconnected` | — | Listener stopped |
|
|
165
|
+
| `error` | `Error` | Network or API error |
|
|
166
|
+
|
|
167
|
+
### InstagramRealtimeListener
|
|
168
|
+
|
|
169
|
+
`InstagramRealtimeListener` connects directly over MQTToT with no polling fallback. Use this when you want pure realtime and prefer to handle reconnection yourself.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { InstagramClient, InstagramRealtimeListener } from 'agent-messenger/instagram'
|
|
173
|
+
|
|
174
|
+
const client = await new InstagramClient().login()
|
|
175
|
+
const listener = new InstagramRealtimeListener(client)
|
|
176
|
+
|
|
177
|
+
listener.on('message', (msg) => {
|
|
178
|
+
console.log(`[${msg.thread_id}] ${msg.from}: ${msg.text}`)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
listener.on('connected', ({ userId }) => {
|
|
182
|
+
console.log(`Listening as ${userId}`)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
listener.on('error', (err) => console.error(err))
|
|
186
|
+
listener.on('disconnected', () => console.log('Disconnected'))
|
|
187
|
+
|
|
188
|
+
await listener.start()
|
|
189
|
+
// listener.stop() to disconnect
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### Events
|
|
193
|
+
|
|
194
|
+
| Event | Payload | Description |
|
|
195
|
+
| -------------- | ------------------------- | ----------------------------- |
|
|
196
|
+
| `message` | `InstagramMessageSummary` | New message received |
|
|
197
|
+
| `connected` | `{ userId: string }` | MQTToT connection established |
|
|
198
|
+
| `disconnected` | — | Connection closed |
|
|
199
|
+
| `error` | `Error` | Connection or protocol error |
|
|
200
|
+
|
|
201
|
+
### InstagramListener (Polling Only)
|
|
202
|
+
|
|
203
|
+
`InstagramListener` polls the Instagram inbox for new messages at a configurable interval. It's the original listener and remains available for environments where a persistent connection isn't suitable.
|
|
126
204
|
|
|
127
205
|
```typescript
|
|
128
206
|
import { InstagramClient, InstagramListener } from 'agent-messenger/instagram'
|
|
@@ -145,7 +223,7 @@ await listener.start()
|
|
|
145
223
|
// listener.stop() to disconnect
|
|
146
224
|
```
|
|
147
225
|
|
|
148
|
-
|
|
226
|
+
#### Events
|
|
149
227
|
|
|
150
228
|
| Event | Payload | Description |
|
|
151
229
|
| -------------- | ------------------------- | --------------------------------------- |
|
|
@@ -220,6 +298,9 @@ import type {
|
|
|
220
298
|
InstagramMessageSummary,
|
|
221
299
|
InstagramSessionState,
|
|
222
300
|
InstagramListenerEventMap,
|
|
301
|
+
InstagramRealtimeListenerEventMap,
|
|
302
|
+
InstagramHybridListenerEventMap,
|
|
303
|
+
InstagramHybridListenerOptions,
|
|
223
304
|
} from 'agent-messenger/instagram'
|
|
224
305
|
```
|
|
225
306
|
|
|
@@ -304,19 +385,23 @@ if (alice) {
|
|
|
304
385
|
|
|
305
386
|
### Message Monitor
|
|
306
387
|
|
|
307
|
-
Watch for new DMs using the
|
|
388
|
+
Watch for new DMs using the hybrid listener, which tries realtime first and falls back to polling automatically.
|
|
308
389
|
|
|
309
390
|
```typescript
|
|
310
|
-
import { InstagramClient,
|
|
391
|
+
import { InstagramClient, InstagramHybridListener } from 'agent-messenger/instagram'
|
|
311
392
|
|
|
312
393
|
const client = await new InstagramClient().login()
|
|
313
|
-
const listener = new
|
|
394
|
+
const listener = new InstagramHybridListener(client)
|
|
314
395
|
|
|
315
396
|
listener.on('message', (msg) => {
|
|
316
397
|
if (msg.is_outgoing) return
|
|
317
398
|
console.log(`New DM from ${msg.from}: ${msg.text ?? `[${msg.type}]`}`)
|
|
318
399
|
})
|
|
319
400
|
|
|
401
|
+
listener.on('connected', ({ userId, transport }) => {
|
|
402
|
+
console.log(`Listening as ${userId} via ${transport}`)
|
|
403
|
+
})
|
|
404
|
+
|
|
320
405
|
listener.on('error', (err) => {
|
|
321
406
|
console.error('Listener error:', err.message)
|
|
322
407
|
})
|
|
@@ -4,11 +4,11 @@ description: A unified terminal interface for all your messaging platforms in on
|
|
|
4
4
|
icon: Monitor
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
> **Experimental** — The TUI is a showcase of what's possible with Agent Messenger's SDK. It's not intended for production use, but demonstrates the power of having a unified adapter layer across
|
|
7
|
+
> **Experimental** — The TUI is a showcase of what's possible with Agent Messenger's SDK. It's not intended for production use, but demonstrates the power of having a unified adapter layer across 11 messaging platforms.
|
|
8
8
|
|
|
9
9
|
## What Is It?
|
|
10
10
|
|
|
11
|
-
The TUI (Terminal User Interface) is a `blessed`-based interactive terminal app that unifies all your messaging platforms into a single screen. Navigate between Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, and Channel Talk — all from your terminal.
|
|
11
|
+
The TUI (Terminal User Interface) is a `blessed`-based interactive terminal app that unifies all your messaging platforms into a single screen. Navigate between Slack, Discord, Teams, Webex, Telegram, WhatsApp, iMessage, LINE, Instagram, KakaoTalk, and Channel Talk — all from your terminal.
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
@@ -30,7 +30,7 @@ The TUI has three navigation levels and three input modes.
|
|
|
30
30
|
|
|
31
31
|
| Level | What it shows | How to enter |
|
|
32
32
|
| ------------- | ---------------------------------------------------------- | ------------------------------------------ |
|
|
33
|
-
| **Platform** | All
|
|
33
|
+
| **Platform** | All 11 platforms with online/offline status | Launch or press `Esc` from workspace level |
|
|
34
34
|
| **Workspace** | Workspaces for the selected platform (skipped if only one) | Select a platform |
|
|
35
35
|
| **Channel** | Channels in the current workspace | Select a workspace |
|
|
36
36
|
|
|
@@ -128,6 +128,7 @@ src/tui/
|
|
|
128
128
|
│ ├── webex-adapter.ts
|
|
129
129
|
│ ├── telegram-adapter.ts
|
|
130
130
|
│ ├── whatsapp-adapter.ts
|
|
131
|
+
│ ├── imessage-adapter.ts
|
|
131
132
|
│ ├── line-adapter.ts
|
|
132
133
|
│ ├── instagram-adapter.ts
|
|
133
134
|
│ ├── kakaotalk-adapter.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-messenger",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams, Webex, Telegram, Telegram Bot, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk)",
|
|
3
|
+
"version": "2.28.0",
|
|
4
|
+
"description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams, Webex, Telegram, Telegram Bot, WhatsApp, LINE, iMessage, Instagram, KakaoTalk, Channel Talk)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/agent-messenger/agent-messenger"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"agent-channeltalkbot": "dist/src/platforms/channeltalkbot/cli.js",
|
|
12
12
|
"agent-discord": "dist/src/platforms/discord/cli.js",
|
|
13
13
|
"agent-discordbot": "dist/src/platforms/discordbot/cli.js",
|
|
14
|
+
"agent-imessage": "dist/src/platforms/imessage/cli.js",
|
|
14
15
|
"agent-instagram": "dist/src/platforms/instagram/cli.js",
|
|
15
16
|
"agent-kakaotalk": "dist/src/platforms/kakaotalk/cli.js",
|
|
16
17
|
"agent-line": "dist/src/platforms/line/cli.js",
|
|
@@ -65,6 +66,9 @@
|
|
|
65
66
|
"wechatbot": [
|
|
66
67
|
"./dist/src/platforms/wechatbot/index.d.ts"
|
|
67
68
|
],
|
|
69
|
+
"imessage": [
|
|
70
|
+
"./dist/src/platforms/imessage/index.d.ts"
|
|
71
|
+
],
|
|
68
72
|
"instagram": [
|
|
69
73
|
"./dist/src/platforms/instagram/index.d.ts"
|
|
70
74
|
],
|
|
@@ -132,6 +136,10 @@
|
|
|
132
136
|
"types": "./dist/src/platforms/wechatbot/index.d.ts",
|
|
133
137
|
"default": "./dist/src/platforms/wechatbot/index.js"
|
|
134
138
|
},
|
|
139
|
+
"./imessage": {
|
|
140
|
+
"types": "./dist/src/platforms/imessage/index.d.ts",
|
|
141
|
+
"default": "./dist/src/platforms/imessage/index.js"
|
|
142
|
+
},
|
|
135
143
|
"./instagram": {
|
|
136
144
|
"types": "./dist/src/platforms/instagram/index.d.ts",
|
|
137
145
|
"default": "./dist/src/platforms/instagram/index.js"
|
package/scripts/postbuild.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { cpSync, readFileSync, writeFileSync } from 'node:fs'
|
|
1
|
+
import { cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
'dist/src/cli.js',
|
|
5
|
-
'dist/src/platforms/slack/cli.js',
|
|
6
|
-
'dist/src/platforms/discord/cli.js',
|
|
7
|
-
'dist/src/platforms/teams/cli.js',
|
|
8
|
-
'dist/src/platforms/slackbot/cli.js',
|
|
9
|
-
'dist/src/platforms/channeltalk/cli.js',
|
|
10
|
-
'dist/src/platforms/channeltalkbot/cli.js',
|
|
11
|
-
'dist/src/platforms/telegram/cli.js',
|
|
12
|
-
'dist/src/platforms/telegrambot/cli.js',
|
|
13
|
-
]
|
|
3
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf8')) as { bin?: Record<string, string> }
|
|
14
4
|
|
|
5
|
+
const cliFiles = Object.values(pkg.bin ?? {}).map((entry) =>
|
|
6
|
+
entry.replace(/^\.\/src\//, 'dist/src/').replace(/\.ts$/, '.js'),
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
let updatedCount = 0
|
|
15
10
|
for (const file of cliFiles) {
|
|
11
|
+
if (!existsSync(file)) continue
|
|
16
12
|
const content = readFileSync(file, 'utf8')
|
|
17
|
-
|
|
18
|
-
writeFileSync(file,
|
|
13
|
+
if (!content.startsWith('#!/usr/bin/env bun')) continue
|
|
14
|
+
writeFileSync(file, content.replace('#!/usr/bin/env bun', '#!/usr/bin/env node'))
|
|
15
|
+
updatedCount++
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
console.log(`Updated shebang in ${
|
|
18
|
+
console.log(`Updated shebang in ${updatedCount} CLI files`)
|
|
22
19
|
|
|
23
20
|
cpSync('src/vendor', 'dist/src/vendor', { recursive: true })
|
|
24
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-channeltalk
|
|
3
3
|
description: Interact with Channel Talk using extracted desktop app or browser credentials - read chats, send messages, search messages, manage groups
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.28.0
|
|
5
5
|
allowed-tools: Bash(agent-channeltalk:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-imessage
|
|
3
|
+
description: Interact with iMessage on a Mac via the imsg tool - send messages, read chats, watch for new messages
|
|
4
|
+
version: 2.28.0
|
|
5
|
+
allowed-tools: Bash(agent-imessage:*)
|
|
6
|
+
metadata:
|
|
7
|
+
openclaw:
|
|
8
|
+
requires:
|
|
9
|
+
bins:
|
|
10
|
+
- agent-imessage
|
|
11
|
+
install:
|
|
12
|
+
- kind: node
|
|
13
|
+
package: agent-messenger
|
|
14
|
+
bins: [agent-imessage]
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Agent iMessage
|
|
18
|
+
|
|
19
|
+
An iMessage CLI for AI agents, backed by [imsg](https://github.com/openclaw/imsg) — a native macOS tool that reads the local Messages database and sends through Messages.app. Apple has no public iMessage API, so this integration runs **on a Mac** and drives Messages locally. You act as yourself with your own Apple ID; nothing leaves the machine.
|
|
20
|
+
|
|
21
|
+
Use one of these entrypoints:
|
|
22
|
+
- Global install: `agent-imessage ...`
|
|
23
|
+
- One-off execution: `bunx --package agent-messenger agent-imessage ...`
|
|
24
|
+
|
|
25
|
+
## Key Concepts
|
|
26
|
+
|
|
27
|
+
- **imsg** = a local Swift CLI (`brew install steipete/tap/imsg`). `agent-imessage` spawns it and talks to it over JSON-RPC (stdin/stdout). There is **no network and no server** — it must run on the Mac signed into iMessage.
|
|
28
|
+
- **On-Mac only** = unlike other agent-messenger platforms, this one cannot run remotely or in a container. The agent runs on the Mac itself.
|
|
29
|
+
- **Permissions** = imsg needs **Full Disk Access** (to read the Messages database) and **Automation → Messages** (to send). macOS grants these to the **parent process** — the app/terminal that launches agent-messenger.
|
|
30
|
+
- **Chat reference** = for `message send`, a chat id (integer rowid), a portable `guid`/`identifier` (e.g. `iMessage;-;+15551234567`), or a phone/email recipient. For `message list`/`react`/`watch --chat`, prefer a **chat id** — a guid also works but (since imsg has no guid→id lookup) is resolved against the 1000 most recent chats only.
|
|
31
|
+
- **Watch** = streams new messages via imsg; resumable from a message rowid with `--since-rowid`.
|
|
32
|
+
- **Multi-account** = each account is an imsg configuration (binary path / region). Send is single-account (Messages has no from-selector).
|
|
33
|
+
- **Private API tier** = typing, edit/unsend, group management, custom/targeted reactions require `imsg launch` (SIP disabled). Basic send/read/watch/standard tapbacks do NOT.
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Guided setup: checks imsg + permissions, saves an account
|
|
39
|
+
agent-imessage setup
|
|
40
|
+
|
|
41
|
+
# Diagnose anytime
|
|
42
|
+
agent-imessage doctor
|
|
43
|
+
|
|
44
|
+
# List chats (source of chat ids/guids)
|
|
45
|
+
agent-imessage chat list
|
|
46
|
+
|
|
47
|
+
# Send (to a chat id, guid, or a phone/email)
|
|
48
|
+
agent-imessage message send 42 "Hello from agent-imessage"
|
|
49
|
+
agent-imessage message send "+15551234567" "Hi"
|
|
50
|
+
|
|
51
|
+
# Read recent messages
|
|
52
|
+
agent-imessage message list 42 --limit 20
|
|
53
|
+
|
|
54
|
+
# Watch for new messages (resumable, JSON lines)
|
|
55
|
+
agent-imessage message watch --chat all --jsonl
|
|
56
|
+
|
|
57
|
+
# React to the most recent incoming message (standard tapbacks)
|
|
58
|
+
agent-imessage message react 42 love
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Setup & Permissions
|
|
62
|
+
|
|
63
|
+
iMessage runs on the Mac via imsg. One-time setup:
|
|
64
|
+
|
|
65
|
+
1. `brew install steipete/tap/imsg`
|
|
66
|
+
2. Sign Messages.app into your Apple ID (a dedicated Apple ID is recommended).
|
|
67
|
+
3. Grant **Full Disk Access** to the app/terminal launching agent-messenger (System Settings → Privacy & Security → Full Disk Access). macOS grants to the **parent process**.
|
|
68
|
+
4. Grant **Automation → Messages** when first prompted (needed to send).
|
|
69
|
+
|
|
70
|
+
See [setup](references/setup.md) and [permissions](references/permissions.md) references for detail.
|
|
71
|
+
|
|
72
|
+
Configuration is scriptable too:
|
|
73
|
+
```bash
|
|
74
|
+
agent-imessage auth set --bin /opt/homebrew/bin/imsg --region US --current
|
|
75
|
+
```
|
|
76
|
+
Environment overrides (runtime only, not persisted): `AGENT_IMESSAGE_BIN`, `AGENT_IMESSAGE_REGION`.
|
|
77
|
+
|
|
78
|
+
### Agent Behavior (MANDATORY)
|
|
79
|
+
|
|
80
|
+
When a command fails, the agent MUST run `agent-imessage doctor` and act on the `suggestion`/`code` rather than telling the user to run commands. If `code` is `imsg_not_found`, guide installing imsg. If `full_disk_access` or `automation_denied`, surface the exact System Settings path (and that macOS grants to the parent process). Never silently retry the same failing call.
|
|
81
|
+
|
|
82
|
+
## Commands
|
|
83
|
+
|
|
84
|
+
- `setup` — guided check + save account.
|
|
85
|
+
- `doctor [--account <id>] [--test-chat <chatId>]` — diagnose imsg + permissions.
|
|
86
|
+
- `auth set|list|use|remove|logout` — manage accounts (binary path / region).
|
|
87
|
+
- `chat list [--limit]` / `chat search <query> [--limit]`.
|
|
88
|
+
- `message list <chat> [--limit] [--start <iso>]` — read history (oldest-last). `<chat>` = chat id (recommended) or recent-chat guid.
|
|
89
|
+
- `message send <chat> <text>` — `<chat>` = chat id/guid or phone/email.
|
|
90
|
+
- `message react <chat> <reaction>` — standard tapback to the **most recent incoming** message.
|
|
91
|
+
- `message watch [--chat <ref|all>] [--since-rowid <n>] [--jsonl]` — stream new messages.
|
|
92
|
+
- `whoami` — active account + imsg status.
|
|
93
|
+
|
|
94
|
+
All commands accept `--account <id>` and `--pretty`.
|
|
95
|
+
|
|
96
|
+
## Output Format
|
|
97
|
+
|
|
98
|
+
JSON by default; `--pretty` for indented output. `message watch --jsonl` emits one JSON object per line.
|
|
99
|
+
|
|
100
|
+
## Feature Tiers
|
|
101
|
+
|
|
102
|
+
| Feature | Available | Requires |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| List/search chats, send text, read/watch messages | ✅ | imsg core (no SIP) |
|
|
105
|
+
| Standard tapbacks, to the most recent incoming message | ✅ | imsg core (no SIP) |
|
|
106
|
+
| React to a specific message / custom-emoji tapbacks | ⏳ planned | imsg bridge (`imsg launch` + SIP) |
|
|
107
|
+
| Typing, read receipts, edit/unsend, group management | ⏳ planned | imsg bridge (`imsg launch` + SIP) |
|
|
108
|
+
|
|
109
|
+
## Error Handling
|
|
110
|
+
|
|
111
|
+
Errors are JSON with a `code` and often a `suggestion`:
|
|
112
|
+
|
|
113
|
+
| Code | Meaning | Action |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| `imsg_not_found` | imsg binary not runnable | `brew install steipete/tap/imsg` (or set `--bin`/`AGENT_IMESSAGE_BIN`). |
|
|
116
|
+
| `full_disk_access` | Can't read Messages DB | Grant Full Disk Access to the launching app (parent process). |
|
|
117
|
+
| `automation_denied` | Can't control Messages | Grant Automation → Messages in System Settings. |
|
|
118
|
+
| `not_authenticated` | No account configured | Run `agent-imessage setup`. |
|
|
119
|
+
| `chat_not_found` | Unknown chat ref | Use a chat id/guid from `chat list`. |
|
|
120
|
+
| `private_api_required` | Feature needs the bridge | Standard send/read/watch/tapbacks work without it; targeted/custom reactions need `imsg launch` (SIP off). |
|
|
121
|
+
| `invalid_limit` | Bad `--limit`/`--since-rowid` | Use an integer 1–100 for `--limit`; non-negative integer for `--since-rowid`. |
|
|
122
|
+
| `send_failed` | imsg could not send | Run `doctor`; on macOS 26 group sends can fail (imsg reports honestly). |
|
|
123
|
+
| `rpc_error` | imsg rpc problem | Run `doctor`; check the imsg version. |
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
- **`agent-imessage doctor`** is the fastest diagnostic — it reports imsg version, Full Disk Access, and the bridge tier.
|
|
128
|
+
- **Permissions denied** — remember macOS grants Full Disk Access / Automation to the **parent** process (the terminal or agent runtime), not just `imsg`.
|
|
129
|
+
- **Reactions only hit the latest message** — that's an imsg/AppleScript limitation without the bridge; reacting to a specific message needs `imsg launch` + SIP off.
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
Account config is stored in `~/.config/agent-messenger/imessage-credentials.json` (mode `0600`). Relocate via `AGENT_MESSENGER_CONFIG_DIR`. No secrets are stored — imsg uses macOS permissions, not tokens.
|