Skip to content

sjkey/openclaw-telegram-approval-buttons

Β 
Β 

Repository files navigation

πŸ” Telegram Approval Buttons for OpenClaw

One-tap exec approvals in Telegram β€” no more typing /approve <uuid> allow-once.

What does this look like?

Plugin workflow: approval request β†’ allowed β†’ health check

What does this do?

OpenClaw's Discord has built-in approval buttons. Telegram doesn't β€” you're stuck typing long /approve commands. This plugin fixes that.

Features:

  • βœ… One-tap approvals β€” Allow Once Β· πŸ” Always Β· ❌ Deny
  • πŸ”„ Auto-resolve β€” edits the message after decision (removes buttons, shows result)
  • ⏰ Expiry handling β€” stale approvals auto-cleaned and marked as expired
  • 🩺 Self-diagnostics β€” /approvalstatus checks health and stats
  • πŸ›‘οΈ Graceful fallback β€” if buttons fail, the original text goes through
  • πŸ“¦ Zero dependencies β€” uses only Node.js built-in fetch

Quick Start

Step 1: Install the plugin

openclaw plugins install telegram-approval-buttons

That's it β€” OpenClaw downloads it from npm and enables it automatically.

Alternative: install from source (for development)
git clone https://github.com/JairFC/openclaw-telegram-approval-buttons.git

Then add the path manually to your openclaw.json:

{
  "plugins": {
    "load": {
      "paths": ["/path/to/openclaw-telegram-approval-buttons"]
    }
  }
}

Step 2: Configure approvals and plugin

Open your ~/.openclaw/openclaw.json and add two things:

  1. Exec approvals targeting Telegram β€” without this, approvals stay as plain text
  2. Plugin config with your bot token and chat ID β€” the plugin needs these to send buttons
{
  "approvals": {
    "exec": {
      "enabled": true,
      "mode": "targets",
      "targets": [
        {
          "channel": "telegram",
          "to": "<your_telegram_chat_id>"
        }
      ]
    }
  },
  "plugins": {
    "entries": {
      "telegram-approval-buttons": {
        "enabled": true,
        "config": {
          "botToken": "<your_bot_token>",
          "chatId": "<your_telegram_chat_id>"
        }
      }
    }
  }
}

πŸ’‘ Where to find these values:

  • Bot token β€” the token you got from @BotFather when creating your bot. It's the same token OpenClaw uses for Telegram.
  • Chat ID β€” your Telegram user ID. Send a message to @userinfobot to get it, or check openclaw logs --follow after sending a message to your bot.

Step 3: Restart and verify

openclaw gateway restart

Then send /approvalstatus in your Telegram chat. You should see:

🟒 Approval Buttons Status

Config: chatId=βœ“ Β· token=βœ“
Telegram: βœ“ connected (@your_bot)
Pending: 0 Β· Processed: 0
Uptime: 1m

⚠️ 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.

That's it! Next time the AI triggers an exec approval, you'll get inline buttons instead of text.

Prerequisites

  • OpenClaw β‰₯ 2026.2.9 installed and running
  • Node.js β‰₯ 20 (uses built-in fetch)
  • Telegram configured in your openclaw.json (bot token + allowFrom)
  • Exec approvals targeting Telegram β€” see Step 2 above

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 converts the callback_data into a synthetic text message β€” no webhook needed.

Configuration

The plugin auto-detects botToken and chatId from your Telegram channel config. Most setups need zero extra configuration.

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

Advanced options

{
  "plugins": {
    "entries": {
      "telegram-approval-buttons": {
        "enabled": true,
        "config": {
          "chatId": "123456789",       // Override auto-detected chat ID
          "botToken": "123:ABC...",     // Override auto-detected bot token
          "staleMins": 10,             // Minutes before stale cleanup (default: 10)
          "verbose": false             // Diagnostic logging (default: false)
        }
      }
    }
  }
}

FAQ

Q: I installed the plugin but I still get old text approvals.
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.

Q: I installed the plugin but no buttons appear at all.
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".

Q: How do I find my Telegram Chat ID?
A: Send /start to @userinfobot on Telegram β€” it replies with your ID. Alternatively, check https://api.telegram.org/bot<TOKEN>/getUpdates after sending a message to your bot.

Q: Do I need to set up a webhook?
A: No! OpenClaw's Telegram integration automatically converts button taps into synthetic text messages. No extra setup needed.

Q: What happens if the plugin fails to send buttons?
A: The original plain-text approval message goes through normally. The plugin never blocks approvals.

Q: Does this work in group chats?
A: Yes, but the bot needs to be an admin or it needs permission to edit its own messages.

Troubleshooting

Problem Fix
DISABLED β€” missing config in logs Add botToken and chatId to plugins.entries.telegram-approval-buttons.config in your ~/.openclaw/openclaw.json. See Step 2.
Still getting old text approvals Your approvals.exec config must target Telegram. See Step 2.
/approvalstatus says "unknown command" Plugin didn't load. Run openclaw plugins install telegram-approval-buttons and restart the gateway.
No buttons appear Check tools.exec.ask is not "off". Run /approvalstatus to check config.
Buttons show but nothing happens Bot needs message editing permission. Use a private chat or make bot admin.
/approvalstatus says "token=βœ—" Set botToken in plugin config. See Step 2.
/approvalstatus says "chatId=βœ—" Set chatId in plugin config. See Step 2.
Buttons say "expired" Approval timed out before you tapped. Adjust staleMins if needed.

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

Contributing

Issues and PRs welcome. Each file in lib/ is self-contained with a single responsibility.

License

MIT

About

OpenClaw plugin: Inline keyboard buttons for exec approval messages in Telegram

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%