← Back to PRs

#14549: feat(telegram): add support for URL-type inline buttons

by kokosthief open 2026-02-12 08:41 View on GitHub →
channel: telegram agents stale size: S
## Summary This PR adds support for Telegram URL-type inline buttons, enabling bots to include buttons that open links directly when tapped. ## Changes - **Updated button types** to support both `callback_data` and `url` - `src/telegram/model-buttons.ts`: Updated `ButtonRow` type - `src/agents/tools/telegram-actions.ts`: Updated `TelegramButton` type - `src/telegram/send.ts`: Updated `TelegramSendOpts` and `TelegramEditOpts` - `src/channels/plugins/outbound/telegram.ts`: Updated channel data types - **Enhanced validation** in `readTelegramButtons` - Accepts buttons with either `callback_data` OR `url` (but not both) - Clear error messages for invalid button configurations - **Updated `buildInlineKeyboard`** to handle both button types - Passes `callback_data` buttons through as before (backward compatible) - Passes `url` buttons to Telegram's InlineKeyboardButton API ## Testing The changes are backward compatible: - Existing `callback_data` buttons work exactly as before - New `url` buttons can now be used Example usage: ```typescript // URL button buttons: [[{ text: "View PR", url: "https://github.com/openclaw/openclaw/pull/123" }]] // Callback button (existing behavior) buttons: [[{ text: "Approve", callback_data: "approve_123" }]] // Mixed row buttons: [[ { text: "View", url: "https://example.com" }, { text: "Delete", callback_data: "delete_123" } ]] ``` ## Closes Fixes #14548 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change extends Telegram inline keyboard support to allow URL buttons in addition to callback buttons. Updates include widening button types across the agent tool parser (`src/agents/tools/telegram-actions.ts`), outbound plugin payload typing (`src/channels/plugins/outbound/telegram.ts`), model button row type (`src/telegram/model-buttons.ts`), and send/edit option types plus keyboard construction (`src/telegram/send.ts`). The core behavior change is in `buildInlineKeyboard`, which now maps either `{ text, callback_data }` or `{ text, url }` into Telegram’s `InlineKeyboardButton` shape. <h3>Confidence Score: 3/5</h3> - Moderately safe, but there are a couple of end-to-end correctness gaps for URL buttons. - Types and mapping for URL buttons are mostly consistent, but one bot delivery path still hard-casts buttons as callback-only, and `buildInlineKeyboard` can accept malformed button objects from unvalidated channelData (leading to Telegram API errors). - src/telegram/bot/delivery.ts, src/telegram/send.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs