Channels
Telegram Approval Buttons
OpenClaw plugin: Inline keyboard buttons for exec approval messages in Telegram
Install
openclaw plugins install @openclaw-community/telegram-approval-buttons
Configuration Example
{
"plugins": {
"entries": {
"telegram-approval-buttons": {
"enabled": true,
"config": {
"chatId": "123456789" // Your Telegram user/chat ID
}
}
}
}
}
README
# telegram-approval-buttons
OpenClaw plugin that adds **inline keyboard buttons** to exec approval messages in Telegram.
Instead of typing `/approve <id> allow-once`, just tap a button.
## Features
- **One-tap approvals** โ โ
Allow Once ยท ๐ Always ยท โ Deny
- **Auto-resolve** โ edits the message after a decision is made (removes buttons, shows result)
- **Expiry handling** โ stale approvals are automatically cleaned up and marked as expired
- **Self-diagnostics** โ `/approvalstatus` command checks config, Telegram connectivity, and stats
- **Graceful fallback** โ if button delivery fails, the original plain-text message goes through
- **Zero dependencies** โ uses only Node.js built-in `fetch`
## How it works
```
โโโโโโโโโโโโโโโ message_sending โโโโโโโโโโโโโโโโโโโโ
โ OpenClaw โ โโโ approval text โโโ โ Plugin โ
โ Gateway โ โ โ
โ โ cancel original โ 1. Parse text โ
โ โ โโโโโโโโโโโโโโโโโโโโโ โ 2. Send buttons โ
โโโโโโโโโโโโโโโ โ 3. Track pending โ
โโโโโโโโโโฌโโโโโโโโโโ
โ
Telegram Bot API
โ
โโโโโโโโโโผโโโโโโโโโโ
โ Telegram Chat โ
โ โ
โ ๐ Exec Approval โ
โ [โ
Allow] [๐] โ
โ [โ Deny] โ
โโโโโโโโโโโโโโโโโโโโ
```
When you tap a button, OpenClaw's Telegram integration converts the `callback_data`
(`/approve <id> <action>`) into a synthetic text message โ no webhook needed.
## Installation
### From extensions directory (local)
```bash
# Copy the plugin into your extensions directory
cp -r telegram-approval-buttons ~/.openclaw/extensions/
# Restart the gateway
openclaw gateway restart
```
### From npm (when published)
```bash
openclaw plugins install @openclaw-community/telegram-approval-buttons
openclaw gateway restart
```
## Configuration
The plugin auto-detects most settings from your existing Telegram channel config.
### Minimal (zero-config if Telegram is already set up)
```jsonc
{
"plugins": {
"entries": {
"telegram-approval-buttons": {
"enabled": true,
"config": {
"chatId": "123456789" // Your Telegram user/chat ID
}
}
}
}
}
```
### Full options
```jsonc
{
"plugins": {
"entries": {
"telegram-approval-buttons": {
"enabled": true,
"config": {
// Required: Telegram chat ID for approval messages
"chatId": "123456789",
// Optional: bot token (auto-detected from channels.telegram.token)
"botToken": "123:ABC...",
// Optional: minutes before stale approvals are cleaned up (default: 10)
"staleMins": 10,
// Optional: verbose diagnostic logging (default: false)
"verbose": false
}
}
}
}
}
```
### Config resolution order
| Setting | Priority 1 (explicit) | Priority 2 (shared config) | Priority 3 (env) |
|------------|-----------------------------|------------------------------------|---------------------------|
| `botToken` | `pluginConfig.botToken` | `channels.telegram.token` | `TELEGRAM_BOT_TOKEN` |
| `chatId` | `pluginConfig.chatId` | `channels.telegram.allowFrom[0]` | `TELEGRAM_CHAT_ID` |
## Commands
| Command | Description | Auth required |
|--------------------|--------------------------------------------- |---------------|
| `/approvalstatus` | Show plugin health, config, and pending stats | Yes |
## Architecture
```
telegram-approval-buttons/
โโโ index.ts # Entry point โ orchestration only
โโโ types.ts # Shared TypeScript interfaces
โโโ lib/
โ โโโ telegram-api.ts # Telegram Bot API client (isolated)
โ โโโ approval-parser.ts # Parse OpenClaw approval text format
โ โโโ message-formatter.ts # HTML formatting for Telegram messages
โ โโโ approval-store.ts # In-memory pending approval tracker
โ โโโ diagnostics.ts # Config resolution, health checks
โโโ openclaw.plugin.json # Plugin manifest
โโโ package.json # npm package metadata
โโโ README.md
```
Each module has a **single responsibility** and can be modified independently:
- **telegram-api.ts** โ swap transport, add retry logic, or mock for testing
- **approval-parser.ts** โ adapt if OpenClaw changes its approval text format
- **message-formatter.ts** โ customize the look and feel of messages
- **approval-store.ts** โ replace with persistent storage if needed
- **diagnostics.ts** โ extend health checks or add auto-repair logic
## Diagnostics
Send `/approvalstatus` in Telegram to get a health report:
```
๐ข Approval Buttons Status
Config: chatId=โ ยท token=โ
Telegram: โ connected (@your_bot)
Pending: 0 ยท Processed: 5
Uptime: 42m
```
## Compatibility
- OpenClaw โฅ 2026.2.9
- Node.js โฅ 22 (uses built-in `fetch`)
- Telegram Bot API (no webhook configuration needed)
## License
MIT
channels
Comments
Sign in to leave a comment