agent-messenger 2.12.0 → 2.12.2
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/CONTRIBUTING.md +12 -0
- package/README.md +30 -4
- 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/kakaotalk/client.d.ts +22 -0
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +93 -7
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/listener.d.ts +4 -7
- package/dist/src/platforms/kakaotalk/listener.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/listener.js +43 -72
- package/dist/src/platforms/kakaotalk/listener.js.map +1 -1
- package/dist/src/platforms/telegrambot/cli.d.ts +5 -0
- package/dist/src/platforms/telegrambot/cli.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/cli.js +29 -0
- package/dist/src/platforms/telegrambot/cli.js.map +1 -0
- package/dist/src/platforms/telegrambot/client.d.ts +85 -0
- package/dist/src/platforms/telegrambot/client.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/client.js +282 -0
- package/dist/src/platforms/telegrambot/client.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/auth.d.ts +31 -0
- package/dist/src/platforms/telegrambot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/auth.js +173 -0
- package/dist/src/platforms/telegrambot/commands/auth.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/chat.d.ts +25 -0
- package/dist/src/platforms/telegrambot/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/chat.js +69 -0
- package/dist/src/platforms/telegrambot/commands/chat.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/index.d.ts +6 -0
- package/dist/src/platforms/telegrambot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/index.js +6 -0
- package/dist/src/platforms/telegrambot/commands/index.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/message.d.ts +39 -0
- package/dist/src/platforms/telegrambot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/message.js +145 -0
- package/dist/src/platforms/telegrambot/commands/message.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/reaction.d.ts +16 -0
- package/dist/src/platforms/telegrambot/commands/reaction.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/reaction.js +49 -0
- package/dist/src/platforms/telegrambot/commands/reaction.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/shared.d.ts +12 -0
- package/dist/src/platforms/telegrambot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/shared.js +21 -0
- package/dist/src/platforms/telegrambot/commands/shared.js.map +1 -0
- package/dist/src/platforms/telegrambot/commands/whoami.d.ts +17 -0
- package/dist/src/platforms/telegrambot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/commands/whoami.js +30 -0
- package/dist/src/platforms/telegrambot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/telegrambot/credential-manager.d.ts +17 -0
- package/dist/src/platforms/telegrambot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/credential-manager.js +113 -0
- package/dist/src/platforms/telegrambot/credential-manager.js.map +1 -0
- package/dist/src/platforms/telegrambot/index.d.ts +7 -0
- package/dist/src/platforms/telegrambot/index.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/index.js +5 -0
- package/dist/src/platforms/telegrambot/index.js.map +1 -0
- package/dist/src/platforms/telegrambot/listener.d.ts +30 -0
- package/dist/src/platforms/telegrambot/listener.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/listener.js +186 -0
- package/dist/src/platforms/telegrambot/listener.js.map +1 -0
- package/dist/src/platforms/telegrambot/types.d.ts +256 -0
- package/dist/src/platforms/telegrambot/types.d.ts.map +1 -0
- package/dist/src/platforms/telegrambot/types.js +96 -0
- package/dist/src/platforms/telegrambot/types.js.map +1 -0
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/telegrambot.mdx +149 -0
- package/docs/content/docs/index.mdx +10 -9
- package/docs/content/docs/quick-start.mdx +2 -0
- package/docs/content/docs/sdk/meta.json +1 -0
- package/docs/content/docs/sdk/telegrambot.mdx +216 -0
- package/e2e/config.ts +24 -0
- package/e2e/helpers.ts +1 -0
- package/e2e/telegrambot.e2e.test.ts +185 -0
- package/examples/telegrambot-listen.ts +54 -0
- package/package.json +10 -2
- package/scripts/postbuild.ts +1 -0
- 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-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +12 -5
- 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 +357 -0
- package/skills/agent-webex/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/kakaotalk/client-listener-integration.test.ts +411 -0
- package/src/platforms/kakaotalk/client.test.ts +3 -0
- package/src/platforms/kakaotalk/client.ts +108 -9
- package/src/platforms/kakaotalk/listener.test.ts +155 -149
- package/src/platforms/kakaotalk/listener.ts +46 -80
- package/src/platforms/telegrambot/cli.ts +34 -0
- package/src/platforms/telegrambot/client.test.ts +454 -0
- package/src/platforms/telegrambot/client.ts +404 -0
- package/src/platforms/telegrambot/commands/auth.test.ts +244 -0
- package/src/platforms/telegrambot/commands/auth.ts +220 -0
- package/src/platforms/telegrambot/commands/chat.ts +96 -0
- package/src/platforms/telegrambot/commands/index.ts +5 -0
- package/src/platforms/telegrambot/commands/message.ts +235 -0
- package/src/platforms/telegrambot/commands/reaction.ts +70 -0
- package/src/platforms/telegrambot/commands/shared.ts +32 -0
- package/src/platforms/telegrambot/commands/whoami.ts +45 -0
- package/src/platforms/telegrambot/credential-manager.test.ts +196 -0
- package/src/platforms/telegrambot/credential-manager.ts +141 -0
- package/src/platforms/telegrambot/index.ts +44 -0
- package/src/platforms/telegrambot/listener.test.ts +398 -0
- package/src/platforms/telegrambot/listener.ts +198 -0
- package/src/platforms/telegrambot/types.test.ts +128 -0
- package/src/platforms/telegrambot/types.ts +282 -0
|
@@ -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.2
|
|
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.
|
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
|
})
|