agent-messenger 2.12.0 → 2.12.1

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.
Files changed (108) hide show
  1. package/.claude-plugin/README.md +11 -1
  2. package/.claude-plugin/marketplace.json +14 -1
  3. package/.claude-plugin/plugin.json +4 -2
  4. package/CONTRIBUTING.md +12 -0
  5. package/README.md +30 -4
  6. package/dist/package.json +10 -2
  7. package/dist/src/cli.d.ts.map +1 -1
  8. package/dist/src/cli.js +3 -0
  9. package/dist/src/cli.js.map +1 -1
  10. package/dist/src/platforms/telegrambot/cli.d.ts +5 -0
  11. package/dist/src/platforms/telegrambot/cli.d.ts.map +1 -0
  12. package/dist/src/platforms/telegrambot/cli.js +29 -0
  13. package/dist/src/platforms/telegrambot/cli.js.map +1 -0
  14. package/dist/src/platforms/telegrambot/client.d.ts +85 -0
  15. package/dist/src/platforms/telegrambot/client.d.ts.map +1 -0
  16. package/dist/src/platforms/telegrambot/client.js +282 -0
  17. package/dist/src/platforms/telegrambot/client.js.map +1 -0
  18. package/dist/src/platforms/telegrambot/commands/auth.d.ts +31 -0
  19. package/dist/src/platforms/telegrambot/commands/auth.d.ts.map +1 -0
  20. package/dist/src/platforms/telegrambot/commands/auth.js +173 -0
  21. package/dist/src/platforms/telegrambot/commands/auth.js.map +1 -0
  22. package/dist/src/platforms/telegrambot/commands/chat.d.ts +25 -0
  23. package/dist/src/platforms/telegrambot/commands/chat.d.ts.map +1 -0
  24. package/dist/src/platforms/telegrambot/commands/chat.js +69 -0
  25. package/dist/src/platforms/telegrambot/commands/chat.js.map +1 -0
  26. package/dist/src/platforms/telegrambot/commands/index.d.ts +6 -0
  27. package/dist/src/platforms/telegrambot/commands/index.d.ts.map +1 -0
  28. package/dist/src/platforms/telegrambot/commands/index.js +6 -0
  29. package/dist/src/platforms/telegrambot/commands/index.js.map +1 -0
  30. package/dist/src/platforms/telegrambot/commands/message.d.ts +39 -0
  31. package/dist/src/platforms/telegrambot/commands/message.d.ts.map +1 -0
  32. package/dist/src/platforms/telegrambot/commands/message.js +145 -0
  33. package/dist/src/platforms/telegrambot/commands/message.js.map +1 -0
  34. package/dist/src/platforms/telegrambot/commands/reaction.d.ts +16 -0
  35. package/dist/src/platforms/telegrambot/commands/reaction.d.ts.map +1 -0
  36. package/dist/src/platforms/telegrambot/commands/reaction.js +49 -0
  37. package/dist/src/platforms/telegrambot/commands/reaction.js.map +1 -0
  38. package/dist/src/platforms/telegrambot/commands/shared.d.ts +12 -0
  39. package/dist/src/platforms/telegrambot/commands/shared.d.ts.map +1 -0
  40. package/dist/src/platforms/telegrambot/commands/shared.js +21 -0
  41. package/dist/src/platforms/telegrambot/commands/shared.js.map +1 -0
  42. package/dist/src/platforms/telegrambot/commands/whoami.d.ts +17 -0
  43. package/dist/src/platforms/telegrambot/commands/whoami.d.ts.map +1 -0
  44. package/dist/src/platforms/telegrambot/commands/whoami.js +30 -0
  45. package/dist/src/platforms/telegrambot/commands/whoami.js.map +1 -0
  46. package/dist/src/platforms/telegrambot/credential-manager.d.ts +17 -0
  47. package/dist/src/platforms/telegrambot/credential-manager.d.ts.map +1 -0
  48. package/dist/src/platforms/telegrambot/credential-manager.js +113 -0
  49. package/dist/src/platforms/telegrambot/credential-manager.js.map +1 -0
  50. package/dist/src/platforms/telegrambot/index.d.ts +7 -0
  51. package/dist/src/platforms/telegrambot/index.d.ts.map +1 -0
  52. package/dist/src/platforms/telegrambot/index.js +5 -0
  53. package/dist/src/platforms/telegrambot/index.js.map +1 -0
  54. package/dist/src/platforms/telegrambot/listener.d.ts +30 -0
  55. package/dist/src/platforms/telegrambot/listener.d.ts.map +1 -0
  56. package/dist/src/platforms/telegrambot/listener.js +186 -0
  57. package/dist/src/platforms/telegrambot/listener.js.map +1 -0
  58. package/dist/src/platforms/telegrambot/types.d.ts +256 -0
  59. package/dist/src/platforms/telegrambot/types.d.ts.map +1 -0
  60. package/dist/src/platforms/telegrambot/types.js +96 -0
  61. package/dist/src/platforms/telegrambot/types.js.map +1 -0
  62. package/docs/content/docs/cli/meta.json +1 -0
  63. package/docs/content/docs/cli/telegrambot.mdx +149 -0
  64. package/docs/content/docs/index.mdx +10 -9
  65. package/docs/content/docs/quick-start.mdx +2 -0
  66. package/docs/content/docs/sdk/meta.json +1 -0
  67. package/docs/content/docs/sdk/telegrambot.mdx +216 -0
  68. package/e2e/config.ts +24 -0
  69. package/e2e/helpers.ts +1 -0
  70. package/e2e/telegrambot.e2e.test.ts +185 -0
  71. package/examples/telegrambot-listen.ts +54 -0
  72. package/package.json +10 -2
  73. package/scripts/postbuild.ts +1 -0
  74. package/skills/agent-channeltalk/SKILL.md +1 -1
  75. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  76. package/skills/agent-discord/SKILL.md +1 -1
  77. package/skills/agent-discordbot/SKILL.md +1 -1
  78. package/skills/agent-instagram/SKILL.md +1 -1
  79. package/skills/agent-kakaotalk/SKILL.md +12 -5
  80. package/skills/agent-line/SKILL.md +1 -1
  81. package/skills/agent-slack/SKILL.md +1 -1
  82. package/skills/agent-slackbot/SKILL.md +1 -1
  83. package/skills/agent-teams/SKILL.md +1 -1
  84. package/skills/agent-telegram/SKILL.md +1 -1
  85. package/skills/agent-telegrambot/SKILL.md +357 -0
  86. package/skills/agent-webex/SKILL.md +1 -1
  87. package/skills/agent-wechatbot/SKILL.md +1 -1
  88. package/skills/agent-whatsapp/SKILL.md +1 -1
  89. package/skills/agent-whatsappbot/SKILL.md +1 -1
  90. package/src/cli.ts +4 -0
  91. package/src/platforms/telegrambot/cli.ts +34 -0
  92. package/src/platforms/telegrambot/client.test.ts +454 -0
  93. package/src/platforms/telegrambot/client.ts +404 -0
  94. package/src/platforms/telegrambot/commands/auth.test.ts +244 -0
  95. package/src/platforms/telegrambot/commands/auth.ts +220 -0
  96. package/src/platforms/telegrambot/commands/chat.ts +96 -0
  97. package/src/platforms/telegrambot/commands/index.ts +5 -0
  98. package/src/platforms/telegrambot/commands/message.ts +235 -0
  99. package/src/platforms/telegrambot/commands/reaction.ts +70 -0
  100. package/src/platforms/telegrambot/commands/shared.ts +32 -0
  101. package/src/platforms/telegrambot/commands/whoami.ts +45 -0
  102. package/src/platforms/telegrambot/credential-manager.test.ts +196 -0
  103. package/src/platforms/telegrambot/credential-manager.ts +141 -0
  104. package/src/platforms/telegrambot/index.ts +44 -0
  105. package/src/platforms/telegrambot/listener.test.ts +398 -0
  106. package/src/platforms/telegrambot/listener.ts +198 -0
  107. package/src/platforms/telegrambot/types.test.ts +128 -0
  108. package/src/platforms/telegrambot/types.ts +282 -0
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env bun
2
+ // Run `agent-telegrambot auth set <token>` first so login() can pick up stored creds.
3
+ import { TelegramBotClient } from '../src/platforms/telegrambot/client'
4
+ import { TelegramBotListener } from '../src/platforms/telegrambot/listener'
5
+
6
+ async function main() {
7
+ const client = await new TelegramBotClient().login()
8
+
9
+ const listener = new TelegramBotListener(client, {
10
+ allowedUpdates: ['message', 'edited_message', 'callback_query', 'my_chat_member'],
11
+ })
12
+
13
+ listener.on('connected', ({ user }) => {
14
+ console.log(`Connected as @${user.username ?? user.first_name} (id: ${user.id})`)
15
+ console.log('Listening for events. Press Ctrl+C to stop.\n')
16
+ })
17
+
18
+ listener.on('disconnected', () => {
19
+ console.log('[disconnected] retrying...')
20
+ })
21
+
22
+ listener.on('message', (message) => {
23
+ if (message.from?.is_bot) return
24
+ const time = new Date(message.date * 1000).toLocaleTimeString()
25
+ const sender = message.from?.username ?? message.from?.first_name ?? 'unknown'
26
+ console.log(`[${time}] message in ${message.chat.id} <${sender}>: ${message.text ?? '(non-text)'}`)
27
+ })
28
+
29
+ listener.on('edited_message', (message) => {
30
+ console.log(`[edit] message ${message.message_id} in ${message.chat.id}`)
31
+ })
32
+
33
+ listener.on('callback_query', (query) => {
34
+ console.log(`[callback] data=${query.data ?? '(none)'} from ${query.from.username ?? query.from.id}`)
35
+ })
36
+
37
+ listener.on('my_chat_member', (event) => {
38
+ console.log(`[my_chat_member] ${event.chat.id}: ${event.old_chat_member.status} -> ${event.new_chat_member.status}`)
39
+ })
40
+
41
+ listener.on('error', (err) => {
42
+ console.error(`[error] ${err.message}`)
43
+ })
44
+
45
+ process.on('SIGINT', () => {
46
+ console.log('\nStopping...')
47
+ listener.stop()
48
+ process.exit(130)
49
+ })
50
+
51
+ await listener.start()
52
+ }
53
+
54
+ main()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-messenger",
3
- "version": "2.12.0",
4
- "description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams, Webex, Telegram, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk)",
3
+ "version": "2.12.1",
4
+ "description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams, Webex, Telegram, Telegram Bot, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk)",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/agent-messenger/agent-messenger"
@@ -19,6 +19,7 @@
19
19
  "agent-slackbot": "dist/src/platforms/slackbot/cli.js",
20
20
  "agent-teams": "dist/src/platforms/teams/cli.js",
21
21
  "agent-telegram": "dist/src/platforms/telegram/cli.js",
22
+ "agent-telegrambot": "dist/src/platforms/telegrambot/cli.js",
22
23
  "agent-webex": "dist/src/platforms/webex/cli.js",
23
24
  "agent-wechatbot": "dist/src/platforms/wechatbot/cli.js",
24
25
  "agent-whatsapp": "dist/src/platforms/whatsapp/cli.js",
@@ -71,6 +72,9 @@
71
72
  ],
72
73
  "channeltalkbot": [
73
74
  "./dist/src/platforms/channeltalkbot/index.d.ts"
75
+ ],
76
+ "telegrambot": [
77
+ "./dist/src/platforms/telegrambot/index.d.ts"
74
78
  ]
75
79
  }
76
80
  },
@@ -135,6 +139,10 @@
135
139
  "./channeltalkbot": {
136
140
  "types": "./dist/src/platforms/channeltalkbot/index.d.ts",
137
141
  "default": "./dist/src/platforms/channeltalkbot/index.js"
142
+ },
143
+ "./telegrambot": {
144
+ "types": "./dist/src/platforms/telegrambot/index.d.ts",
145
+ "default": "./dist/src/platforms/telegrambot/index.js"
138
146
  }
139
147
  },
140
148
  "scripts": {
@@ -9,6 +9,7 @@ const cliFiles = [
9
9
  'dist/src/platforms/channeltalk/cli.js',
10
10
  'dist/src/platforms/channeltalkbot/cli.js',
11
11
  'dist/src/platforms/telegram/cli.js',
12
+ 'dist/src/platforms/telegrambot/cli.js',
12
13
  ]
13
14
 
14
15
  for (const file of cliFiles) {
@@ -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.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-channeltalk:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-channeltalkbot
3
3
  description: Interact with Channel Talk workspaces using API credentials - send messages, read chats, manage groups and bots
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-channeltalkbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-discord
3
3
  description: Interact with Discord servers - send messages, read channels, manage reactions
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-discord:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-discordbot
3
3
  description: Interact with Discord servers using bot tokens - send messages, read channels, manage reactions
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-discordbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-instagram
3
3
  description: Interact with Instagram DMs - send messages, read conversations, manage accounts
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-instagram:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-kakaotalk
3
3
  description: Interact with KakaoTalk - send messages, read chats, manage conversations
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-kakaotalk:*)
6
6
  metadata:
7
7
  openclaw:
@@ -56,7 +56,7 @@ Registers the CLI as a sub-device (tablet slot by default). Your desktop app kee
56
56
  agent-kakaotalk auth login
57
57
  ```
58
58
 
59
- In interactive mode, this prompts for email and password. The CLI first tries to extract cached credentials from the desktop app so you may not need to type anything.
59
+ In interactive mode, this prompts for email and password. On macOS and Windows, the CLI first tries to extract cached credentials from the desktop app so you may not need to type anything. On Linux there is no desktop app, so always pass credentials explicitly via `--email` and `--password` (or `--password-file`).
60
60
 
61
61
  For AI agents (non-interactive), provide credentials via flags:
62
62
 
@@ -488,8 +488,7 @@ See the [KakaoTalk SDK documentation](https://agent-messenger.dev/docs/sdk/kakao
488
488
 
489
489
  ## Limitations
490
490
 
491
- - macOS and Windows only (desktop app needed for auto-extracting email/password during login)
492
- - No Linux support (KakaoTalk desktop not available on Linux)
491
+ - Auto-extraction of email/password from the desktop app is **macOS and Windows only** (KakaoTalk desktop is not available on Linux). Linux users must pass `--email` and `--password` (or `--password-file`) explicitly — the LOCO protocol, login flow, and all messaging features work on Linux.
493
492
  - No file upload or download
494
493
  - No channel/chat room creation or management
495
494
  - No friend list management
@@ -526,7 +525,15 @@ pnpm dlx --package agent-messenger agent-kakaotalk chat list --pretty
526
525
 
527
526
  ### Password prompt on fresh install
528
527
 
529
- On fresh installs, the desktop app (macOS or Windows) may hash or omit the password from its cache, so the CLI cannot extract it automatically. The CLI will prompt for the password once to register the device — via a native dialog on macOS (AppKit) and Windows (PowerShell WinForms), or via a TTY prompt if a terminal is available. After registration, the password is never needed again.
528
+ On fresh installs, the desktop app (macOS or Windows) may hash or omit the password from its cache, so the CLI cannot extract it automatically. The CLI will prompt for the password once to register the device — via a native dialog on macOS (AppKit), Windows (PowerShell WinForms), or Linux (`zenity` / `kdialog`), or via a TTY prompt if a terminal is available. After registration, the password is never needed again.
529
+
530
+ On Linux there is no desktop app to extract from, so always provide credentials explicitly:
531
+
532
+ ```bash
533
+ agent-kakaotalk auth login --email user@example.com --password-file /tmp/.kakao-pw
534
+ ```
535
+
536
+ `--password-file` reads the file then immediately deletes it, so the password never appears in shell history or process listings.
530
537
 
531
538
  When the CLI returns `{"next_action": "run_interactive", ...}`, use a tmux session to let the user type their password securely. See "Handling `run_interactive`" above for the exact steps.
532
539
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-line
3
3
  description: Interact with LINE - send messages, read chats, manage conversations
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-line:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-slack
3
3
  description: Interact with Slack workspaces - send messages, read channels, manage reactions
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-slack:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-slackbot
3
3
  description: Interact with Slack workspaces using bot tokens - send messages, read channels, manage reactions
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-slackbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-teams
3
3
  description: Interact with Microsoft Teams - send messages, read channels, manage reactions
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-teams:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-telegram
3
3
  description: Interact with Telegram through TDLib - authenticate, inspect chats, and send messages
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-telegram:*)
6
6
  ---
7
7
 
@@ -0,0 +1,357 @@
1
+ ---
2
+ name: agent-telegrambot
3
+ description: Interact with Telegram using bot tokens - send messages, read chats, manage reactions
4
+ version: 2.12.1
5
+ allowed-tools: Bash(agent-telegrambot:*)
6
+ metadata:
7
+ openclaw:
8
+ requires:
9
+ bins:
10
+ - agent-telegrambot
11
+ install:
12
+ - kind: node
13
+ package: agent-messenger
14
+ bins: [agent-telegrambot]
15
+ ---
16
+
17
+ # Agent TelegramBot
18
+
19
+ A TypeScript CLI tool that enables AI agents and humans to interact with Telegram using **Bot API tokens** (the kind issued by [@BotFather](https://t.me/BotFather)). Unlike `agent-telegram` which authenticates as a real user account via TDLib, `agent-telegrambot` uses Telegram's HTTP Bot API — designed for server-side and CI/CD integrations.
20
+
21
+ ## Key Concepts
22
+
23
+ Before diving in, a few things about Telegram Bot integration:
24
+
25
+ - **Bot tokens** — Issued by talking to [@BotFather](https://t.me/BotFather) inside Telegram. Format: `123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11`. Bot acts as its own bot account, with a username ending in `bot`.
26
+ - **Bot ≠ User** — Bots cannot initiate DMs. The user must `/start` the bot first. In groups, bots receive only messages mentioning them or commands unless privacy mode is disabled in BotFather settings.
27
+ - **Chat IDs** — Numeric IDs (positive for users, negative for groups, very negative for supergroups/channels). Channels can also be referenced by `@channelusername`.
28
+ - **Real-time events** — Available via the SDK's long-polling listener (`getUpdates`), not via the CLI. Telegram Bot API does not support WebSockets.
29
+ - **Webhook vs polling** — A bot can use webhooks OR long-polling, not both. The SDK listener auto-disables any active webhook before polling.
30
+
31
+ ## Quick Start
32
+
33
+ ```bash
34
+ # Set your bot token (validates against Telegram)
35
+ agent-telegrambot auth set 123456789:ABC-DEF1234...
36
+
37
+ # Verify authentication
38
+ agent-telegrambot whoami
39
+
40
+ # Send a message
41
+ agent-telegrambot message send @username "Hello from bot!"
42
+
43
+ # Get chat info
44
+ agent-telegrambot chat info @somegroup
45
+ ```
46
+
47
+ ## Authentication
48
+
49
+ ### Bot Token Setup
50
+
51
+ `agent-telegrambot` uses Bot API tokens which you create by chatting with [@BotFather](https://t.me/BotFather):
52
+
53
+ ```bash
54
+ # Set bot token (validates against Telegram API before saving)
55
+ agent-telegrambot auth set 123456789:ABC-DEF1234...
56
+
57
+ # Set with a custom bot identifier
58
+ agent-telegrambot auth set <token> --bot deploy
59
+
60
+ # Check auth status
61
+ agent-telegrambot auth status
62
+
63
+ # Clear stored credentials
64
+ agent-telegrambot auth clear
65
+ ```
66
+
67
+ ### Multi-Bot Support
68
+
69
+ ```bash
70
+ # List all configured bots
71
+ agent-telegrambot auth list
72
+
73
+ # Switch active bot
74
+ agent-telegrambot auth use <bot-id>
75
+
76
+ # Remove a bot
77
+ agent-telegrambot auth remove <bot-id>
78
+
79
+ # Use a specific bot for a single command
80
+ agent-telegrambot --bot deploy message send @channel "Deploy succeeded"
81
+ ```
82
+
83
+ ## Memory
84
+
85
+ The agent maintains a `~/.config/agent-messenger/MEMORY.md` file as persistent memory across sessions. This is agent-managed — the CLI does not read or write this file. Use the `Read` and `Write` tools to manage your memory file.
86
+
87
+ ### What to Store
88
+
89
+ - Chat IDs with names (e.g. `-1001234567890` → "alerts channel")
90
+ - User IDs with display names (e.g. `123456789` → "Alice")
91
+ - Bot identifiers and their purposes
92
+ - User-given aliases ("the alerts bot", "the team channel")
93
+
94
+ ### What NOT to Store
95
+
96
+ Never store bot tokens, credentials, or any sensitive data. Never store full message content (just IDs and chat context).
97
+
98
+ ### Format / Example
99
+
100
+ ```markdown
101
+ # Agent Messenger Memory
102
+
103
+ ## Telegram Bots
104
+
105
+ - `deploy` — Deploy Bot (active)
106
+ - `alert` — Alert Bot
107
+
108
+ ## Chats (Deploy Bot)
109
+
110
+ - `-1001234567890` — #ci-alerts (channel)
111
+ - `-1009876543210` — Engineering (supergroup)
112
+ - `123456789` — Alice (DM)
113
+
114
+ ## Aliases
115
+
116
+ - "alerts" → `-1001234567890`
117
+ ```
118
+
119
+ ## Commands
120
+
121
+ ### Auth Commands
122
+
123
+ ```bash
124
+ # Set bot token
125
+ agent-telegrambot auth set <token>
126
+ agent-telegrambot auth set <token> --bot deploy
127
+
128
+ # Check auth status
129
+ agent-telegrambot auth status
130
+ agent-telegrambot auth status --bot deploy
131
+
132
+ # Clear all credentials
133
+ agent-telegrambot auth clear
134
+
135
+ # List stored bots
136
+ agent-telegrambot auth list
137
+
138
+ # Switch active bot
139
+ agent-telegrambot auth use <bot-id>
140
+
141
+ # Remove a stored bot
142
+ agent-telegrambot auth remove <bot-id>
143
+ ```
144
+
145
+ ### Whoami Command
146
+
147
+ ```bash
148
+ # Show current authenticated bot
149
+ agent-telegrambot whoami
150
+ agent-telegrambot whoami --pretty
151
+ agent-telegrambot whoami --bot <bot-id>
152
+ ```
153
+
154
+ ### Message Commands
155
+
156
+ ```bash
157
+ # Send a text message
158
+ agent-telegrambot message send <chat> <text>
159
+ agent-telegrambot message send @username "Hello"
160
+ agent-telegrambot message send -1001234567890 "Hello channel"
161
+
162
+ # Send with formatting
163
+ agent-telegrambot message send @username "<b>Bold</b> message" --parse-mode HTML
164
+
165
+ # Reply to a specific message
166
+ agent-telegrambot message send @username "Reply text" --reply-to 12345
167
+
168
+ # Send silently (no notification)
169
+ agent-telegrambot message send @username "Silent message" --silent
170
+
171
+ # Send to a forum topic
172
+ agent-telegrambot message send <chat> "Topic message" --thread-id 5
173
+
174
+ # Edit a message (bot's own messages only)
175
+ agent-telegrambot message update <chat> <message-id> <new-text>
176
+
177
+ # Delete a message
178
+ agent-telegrambot message delete <chat> <message-id> --force
179
+
180
+ # Forward a message between chats
181
+ agent-telegrambot message forward <to-chat> <from-chat> <message-id>
182
+
183
+ # Upload a document
184
+ agent-telegrambot message upload <chat> ./report.pdf --caption "Daily report"
185
+ ```
186
+
187
+ ### Chat Commands
188
+
189
+ ```bash
190
+ # Get chat info
191
+ agent-telegrambot chat info <chat>
192
+ agent-telegrambot chat info @somegroup
193
+ agent-telegrambot chat info -1001234567890
194
+
195
+ # Get chat member info
196
+ agent-telegrambot chat member <chat> <user-id>
197
+ ```
198
+
199
+ ### Reaction Commands
200
+
201
+ ```bash
202
+ # Set a reaction (replaces any existing reaction by the bot)
203
+ agent-telegrambot reaction set <chat> <message-id> 👍
204
+ agent-telegrambot reaction set <chat> <message-id> 👍 --big
205
+
206
+ # Clear all reactions
207
+ agent-telegrambot reaction clear <chat> <message-id>
208
+ ```
209
+
210
+ ## Output Format
211
+
212
+ ### JSON (Default)
213
+
214
+ All commands output JSON by default for AI consumption:
215
+
216
+ ```json
217
+ {
218
+ "message": {
219
+ "message_id": 42,
220
+ "chat_id": -1001234567890,
221
+ "text": "Hello",
222
+ "from": "mybot",
223
+ "date": 1735689600
224
+ }
225
+ }
226
+ ```
227
+
228
+ ### Pretty (Human-Readable)
229
+
230
+ Use `--pretty` flag for formatted output:
231
+
232
+ ```bash
233
+ agent-telegrambot message send @username "Hello" --pretty
234
+ ```
235
+
236
+ ## Global Options
237
+
238
+ | Option | Description |
239
+ | ------------ | -------------------------------------- |
240
+ | `--pretty` | Human-readable output instead of JSON |
241
+ | `--bot <id>` | Use a specific bot for this command |
242
+
243
+ ## Chat ID Resolution
244
+
245
+ The `<chat>` argument accepts:
246
+
247
+ - **Numeric ID**: `123456789` (user), `-1001234567890` (channel/supergroup)
248
+ - **@username**: `@channelname`, `@username` (must be public)
249
+ - **Plain username**: `channelname` (auto-prefixed with `@`)
250
+
251
+ Bots cannot DM a user who has never started a chat with the bot. The user must send `/start` first.
252
+
253
+ ## Real-Time Events
254
+
255
+ Real-time events are NOT available in the CLI but ARE available via the SDK using long-polling:
256
+
257
+ ```typescript
258
+ import { TelegramBotClient, TelegramBotListener } from 'agent-messenger/telegrambot'
259
+
260
+ const client = await new TelegramBotClient().login({ token: 'YOUR_BOT_TOKEN' })
261
+ const listener = new TelegramBotListener(client, {
262
+ allowedUpdates: ['message', 'callback_query'],
263
+ })
264
+
265
+ listener.on('message', (msg) => {
266
+ console.log(`From ${msg.chat.id}: ${msg.text}`)
267
+ })
268
+
269
+ await listener.start()
270
+ ```
271
+
272
+ Long-polling means the bot opens a long-lived HTTPS connection that the server holds open until updates arrive. No public endpoint is required — perfect for CI/CD and behind-NAT environments.
273
+
274
+ ## Error Handling
275
+
276
+ All commands return consistent error format:
277
+
278
+ ```json
279
+ {
280
+ "error": "Forbidden: bot can't initiate conversation with a user"
281
+ }
282
+ ```
283
+
284
+ Common errors:
285
+
286
+ - `Unauthorized` — Invalid or revoked bot token. Generate a new token via @BotFather.
287
+ - `Forbidden` — Bot was kicked from chat, or user hasn't started the bot, or bot lacks permissions.
288
+ - `Bad Request: chat not found` — Wrong chat ID, or the bot isn't a member of that chat.
289
+ - `Conflict` — Another `getUpdates` call is in progress (only one polling instance allowed per bot).
290
+ - `Too Many Requests` — Rate limited; the client automatically retries after the `retry_after` interval.
291
+
292
+ ## Configuration
293
+
294
+ Credentials stored in `~/.config/agent-messenger/telegrambot-credentials.json` (0600 permissions). The location can be overridden with `AGENT_MESSENGER_CONFIG_DIR`.
295
+
296
+ ## Key Differences from agent-telegram
297
+
298
+ | Feature | agent-telegram (TDLib) | agent-telegrambot (Bot API) |
299
+ | -------------------- | --------------------------------- | --------------------------------- |
300
+ | Token type | User session (TDLib) | Bot token (BotFather) |
301
+ | Auth | Phone + code, stateful | One-time token from BotFather |
302
+ | Initiate DMs | Yes | No (user must `/start` first) |
303
+ | Read all group msgs | Yes | Only with privacy mode disabled |
304
+ | ToS for automation | Grey area at scale | Officially sanctioned |
305
+ | CI/CD friendly | Possible (persist auth state) | Yes (just set token) |
306
+ | Real-time events | Yes (TDLib updates) | Yes (long-polling getUpdates) |
307
+ | Inline keyboards | No | Yes (via SDK) |
308
+
309
+ ## Limitations
310
+
311
+ - Bots cannot initiate DMs — user must send `/start` first
312
+ - Bots cannot read group messages by default (privacy mode is on by default; turn it off via @BotFather for full access, or grant admin)
313
+ - Bot can only edit/delete its own messages, except in groups where it has delete permissions
314
+ - Plain text messages with optional HTML/Markdown parse modes (no inline keyboards from the CLI yet — use the SDK)
315
+ - File uploads use multipart/form-data; max 50MB per file via the standard Bot API server
316
+ - Only one `getUpdates` polling instance can run per bot (Telegram returns 409 Conflict otherwise)
317
+
318
+ ## Troubleshooting
319
+
320
+ ### `agent-telegrambot: command not found`
321
+
322
+ **`agent-telegrambot` is NOT the npm package name.** The npm package is `agent-messenger`.
323
+
324
+ If the package is installed globally, use `agent-telegrambot` directly:
325
+
326
+ ```bash
327
+ agent-telegrambot message send @username "Hello"
328
+ ```
329
+
330
+ If the package is NOT installed, use `npx -y` by default:
331
+
332
+ ```bash
333
+ npx -y agent-messenger telegrambot message send @username "Hello"
334
+ bunx agent-messenger telegrambot message send @username "Hello"
335
+ pnpm dlx agent-messenger telegrambot message send @username "Hello"
336
+ ```
337
+
338
+ > If you already know the user's preferred package runner (e.g., `bunx`, `pnpm dlx`), use that instead.
339
+
340
+ **NEVER run `npx agent-telegrambot`, `bunx agent-telegrambot`, or `pnpm dlx agent-telegrambot`** — it will fail or install a wrong package since `agent-telegrambot` is not the npm package name.
341
+
342
+ ### "Forbidden: bot can't initiate conversation with a user"
343
+
344
+ The user has never started a chat with the bot. They need to find the bot in Telegram and tap **Start** (or send `/start`) before the bot can message them.
345
+
346
+ ### "Conflict: terminated by other getUpdates request"
347
+
348
+ Another instance (or a stale webhook) is polling the same bot. Stop other instances, or run:
349
+
350
+ ```bash
351
+ # Through the SDK or curl - no CLI helper for this yet
352
+ curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook?drop_pending_updates=true"
353
+ ```
354
+
355
+ ### "Bad Request: chat not found"
356
+
357
+ Either the chat ID is wrong, the username is misspelled, or the bot isn't a member of that chat. Make sure the bot has been added to the group/channel and (for channels) given posting permission.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-webex
3
3
  description: Interact with Cisco Webex - send messages, read spaces, manage memberships
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-webex:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-wechatbot
3
3
  description: Interact with WeChat Official Account using API credentials - send messages, manage templates, list followers
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-wechatbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsapp
3
3
  description: Interact with WhatsApp - send messages, read chats, manage conversations
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-whatsapp:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsappbot
3
3
  description: Interact with WhatsApp using Cloud API credentials - send messages, manage templates
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  allowed-tools: Bash(agent-whatsappbot:*)
6
6
  metadata:
7
7
  openclaw:
package/src/cli.ts CHANGED
@@ -40,6 +40,10 @@ program.command('telegram', 'Interact with Telegram via TDLib', {
40
40
  executableFile: join(__dirname, 'platforms', 'telegram', `cli${ext}`),
41
41
  })
42
42
 
43
+ program.command('telegrambot', 'Interact with Telegram using bot tokens', {
44
+ executableFile: join(__dirname, 'platforms', 'telegrambot', `cli${ext}`),
45
+ })
46
+
43
47
  program.command('whatsapp', 'Interact with WhatsApp via linked device', {
44
48
  executableFile: join(__dirname, 'platforms', 'whatsapp', `cli${ext}`),
45
49
  })