telegram-approval-buttons 4.0.2 → 4.0.3

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 (3) hide show
  1. package/README.md +63 -15
  2. package/index.ts +2 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## What does this look like?
6
6
 
7
7
  <p align="center">
8
- <img src="docs/banner.png" alt="Plugin workflow: approval request → allowed → health check" />
8
+ <img src="https://raw.githubusercontent.com/JairFC/openclaw-telegram-approval-buttons/main/docs/banner.png" alt="Plugin workflow: approval request → allowed → health check" />
9
9
  </p>
10
10
 
11
11
  ## What does this do?
@@ -22,33 +22,73 @@ OpenClaw's Discord has built-in approval buttons. **Telegram doesn't** — you'r
22
22
 
23
23
  ## Quick Start
24
24
 
25
- ### Step 1: Download the plugin
25
+ ### Step 1: Install the plugin
26
26
 
27
27
  ```bash
28
- git clone https://github.com/JairFC/openclaw-telegram-approval-buttons.git
28
+ openclaw plugins install telegram-approval-buttons
29
29
  ```
30
30
 
31
- ### Step 2: Add to your config
31
+ That's it OpenClaw downloads it from npm and enables it automatically.
32
32
 
33
- Open your `openclaw.json` and add this block. If the `"plugins"` section already exists, just merge the contents:
33
+ <details>
34
+ <summary>Alternative: install from source (for development)</summary>
35
+
36
+ ```bash
37
+ git clone https://github.com/JairFC/openclaw-telegram-approval-buttons.git
38
+ ```
39
+
40
+ Then add the path manually to your `openclaw.json`:
34
41
 
35
42
  ```jsonc
36
43
  {
37
44
  "plugins": {
38
45
  "load": {
39
46
  "paths": ["/path/to/openclaw-telegram-approval-buttons"]
40
- },
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ </details>
53
+
54
+ ### Step 2: Configure approvals and plugin
55
+
56
+ Open your `~/.openclaw/openclaw.json` and add two things:
57
+
58
+ 1. **Exec approvals targeting Telegram** — without this, approvals stay as plain text
59
+ 2. **Plugin config with your bot token and chat ID** — the plugin needs these to send buttons
60
+
61
+ ```jsonc
62
+ {
63
+ "approvals": {
64
+ "exec": {
65
+ "enabled": true,
66
+ "mode": "targets",
67
+ "targets": [
68
+ {
69
+ "channel": "telegram",
70
+ "to": "<your_telegram_chat_id>"
71
+ }
72
+ ]
73
+ }
74
+ },
75
+ "plugins": {
41
76
  "entries": {
42
77
  "telegram-approval-buttons": {
43
- "enabled": true
78
+ "enabled": true,
79
+ "config": {
80
+ "botToken": "<your_bot_token>",
81
+ "chatId": "<your_telegram_chat_id>"
82
+ }
44
83
  }
45
84
  }
46
85
  }
47
86
  }
48
87
  ```
49
88
 
50
- > 💡 **Replace `/path/to/`** with the actual path where you cloned the repo.
51
- > Example: `"~/Projects/openclaw-telegram-approval-buttons"`
89
+ > 💡 **Where to find these values:**
90
+ > - **Bot token** — the token you got from [@BotFather](https://t.me/BotFather) when creating your bot. It's the same token OpenClaw uses for Telegram.
91
+ > - **Chat ID** — your Telegram user ID. Send a message to [@userinfobot](https://t.me/userinfobot) to get it, or check `openclaw logs --follow` after sending a message to your bot.
52
92
 
53
93
  ### Step 3: Restart and verify
54
94
 
@@ -67,14 +107,16 @@ Pending: 0 · Processed: 0
67
107
  Uptime: 1m
68
108
  ```
69
109
 
70
- **That's it!** Next time the AI triggers an `exec` approval, you'll get buttons.
110
+ > ⚠️ **If you see `DISABLED — missing config`**, the plugin can't find your bot token or chat ID. Double-check that `botToken` and `chatId` are set in `plugins.entries.telegram-approval-buttons.config` in your `~/.openclaw/openclaw.json`.
111
+
112
+ **That's it!** Next time the AI triggers an `exec` approval, you'll get inline buttons instead of text.
71
113
 
72
114
  ## Prerequisites
73
115
 
74
116
  - **OpenClaw ≥ 2026.2.9** installed and running
75
117
  - **Node.js ≥ 22** (uses built-in `fetch`)
76
- - **Telegram configured** in your `openclaw.json`
77
- - **Exec approvals enabled** — `tools.exec.ask` must NOT be `"off"`
118
+ - **Telegram configured** in your `openclaw.json` (bot token + `allowFrom`)
119
+ - **Exec approvals targeting Telegram** — see Step 2 above
78
120
 
79
121
  ## How it works
80
122
 
@@ -133,7 +175,10 @@ The plugin **auto-detects** `botToken` and `chatId` from your Telegram channel c
133
175
 
134
176
  ## FAQ
135
177
 
136
- **Q: I installed the plugin but no buttons appear.**
178
+ **Q: I installed the plugin but I still get old text approvals.**
179
+ A: Most likely your `approvals.exec` section is missing or doesn't target Telegram. Make sure you have `"mode": "targets"` with a target pointing to `"channel": "telegram"` — see Step 2 above. Restart the gateway after changing the config.
180
+
181
+ **Q: I installed the plugin but no buttons appear at all.**
137
182
  A: Make sure `tools.exec.ask` is NOT set to `"off"` in your config. If it's `"off"`, there are no approvals to buttonize. Set it to `"on-miss"` or `"always"`.
138
183
 
139
184
  **Q: How do I find my Telegram Chat ID?**
@@ -152,10 +197,13 @@ A: Yes, but the bot needs to be an admin or it needs permission to edit its own
152
197
 
153
198
  | Problem | Fix |
154
199
  |---------|-----|
200
+ | `DISABLED — missing config` in logs | Add `botToken` and `chatId` to `plugins.entries.telegram-approval-buttons.config` in your `~/.openclaw/openclaw.json`. See Step 2. |
201
+ | Still getting old text approvals | Your `approvals.exec` config must target Telegram. See Step 2. |
202
+ | `/approvalstatus` says "unknown command" | Plugin didn't load. Run `openclaw plugins install telegram-approval-buttons` and restart the gateway. |
155
203
  | No buttons appear | Check `tools.exec.ask` is not `"off"`. Run `/approvalstatus` to check config. |
156
204
  | Buttons show but nothing happens | Bot needs message editing permission. Use a private chat or make bot admin. |
157
- | `/approvalstatus` says "token=✗" | Set `botToken` in plugin config, or check `channels.telegram.token`. |
158
- | `/approvalstatus` says "chatId=✗" | Set `chatId` in plugin config, or add your ID to `channels.telegram.allowFrom`. |
205
+ | `/approvalstatus` says "token=✗" | Set `botToken` in plugin config. See Step 2. |
206
+ | `/approvalstatus` says "chatId=✗" | Set `chatId` in plugin config. See Step 2. |
159
207
  | Buttons say "expired" | Approval timed out before you tapped. Adjust `staleMins` if needed. |
160
208
 
161
209
  ## Architecture
package/index.ts CHANGED
@@ -30,7 +30,7 @@ import {
30
30
 
31
31
  // ── Constants ───────────────────────────────────────────────────────────────
32
32
 
33
- const PLUGIN_VERSION = "4.0.1";
33
+ const PLUGIN_VERSION = "4.0.3";
34
34
  const TAG = "telegram-approval-buttons";
35
35
 
36
36
  // ── Plugin registration ─────────────────────────────────────────────────────
@@ -48,7 +48,7 @@ function register(api: any): void {
48
48
  {
49
49
  pluginConfig: pluginCfg,
50
50
  telegramChannelConfig: {
51
- token: telegramCfg.token,
51
+ token: telegramCfg.token || telegramCfg.botToken,
52
52
  allowFrom: telegramCfg.allowFrom,
53
53
  },
54
54
  env: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-approval-buttons",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Inline keyboard buttons for exec approval messages in Telegram — tap to approve/deny without typing commands",
5
5
  "type": "module",
6
6
  "main": "index.ts",