feat(telegram): implement sendPayload for channelData support#1917
Merged
obviyus merged 5 commits intoopenclaw:mainfrom Jan 26, 2026
Merged
feat(telegram): implement sendPayload for channelData support#1917obviyus merged 5 commits intoopenclaw:mainfrom
obviyus merged 5 commits intoopenclaw:mainfrom
Conversation
Add sendPayload handler to Telegram outbound adapter to support channel-specific data via the channelData pattern. This enables features like inline keyboard buttons without custom ReplyPayload fields. Implementation: - Extract telegram.buttons from payload.channelData - Pass buttons to sendMessageTelegram (already supports this) - Follows existing sendText/sendMedia patterns - Completes optional ChannelOutboundAdapter.sendPayload interface This enables plugins to send Telegram-specific features (buttons, etc.) using the standard channelData envelope pattern instead of custom fields. Related: delivery system in src/infra/outbound/deliver.ts:324 already checks for sendPayload handler and routes accordingly. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…ay types - Add plugin command specs to Telegram setMyCommands for autocomplete - Export GatewayRequestHandler types in plugin-sdk for plugin authors - Enables plugins to register gateway methods and appear in command menus
Plugin commands were added to setMyCommands menu but didn't have bot.command() handlers registered. This meant /flow-start and other plugin commands would fall through to the general message handler instead of being dispatched to the plugin command executor. Now we register bot.command() handlers for each plugin command, with full authorization checks and proper result delivery.
Plugin commands can return buttons in channelData.telegram.buttons, but deliverReplies() was ignoring them. Now we: 1. Extract buttons from reply.channelData?.telegram?.buttons 2. Build inline keyboard using buildInlineKeyboard() 3. Pass reply_markup to sendMessage() Buttons are attached to the first text chunk when text is chunked.
1a8f367 to
96f1c6f
Compare
Contributor
|
Landed via temp rebase onto main. Changes:
Thanks @JoshuaLelon! |
tyler6204
added a commit
that referenced
this pull request
Jan 27, 2026
Summary
Implements plugin support for Telegram-specific features:
channelDatapattern (inline buttons, etc.)/autocomplete menubot.command()handlers so plugin commands execute deterministicallyMotivation
Plugins need access to Telegram-specific features and gateway RPC methods:
The infrastructure exists in core but wasn't fully wired up for plugins.
Changes
1. Telegram sendPayload Handler
sendPayloadhandler totelegramOutboundadaptertelegram.buttonsfrompayload.channelDatasendMessageTelegramfunction (already supports this)2. Plugin Command Menu Sync
getPluginCommandSpecs()inbot-native-commands.tsallCommandsarray/menu alongside native commands3. Plugin Command Handler Registration
bot.command()handlers for each plugin commandexecutePluginCommand()Critical Fix: Without this, plugin commands show in the menu but fall through to the general message handler, where the LLM processes them conversationally instead of executing them deterministically.
4. Button Extraction in deliverReplies
reply.channelData?.telegram?.buttonsindeliverReplies()buildInlineKeyboard()reply_markuptosendMessage()APICritical Fix: Plugin commands can return buttons in
channelData, butdeliverReplies()was ignoring them. Now buttons render properly.5. Gateway Method Types Export
GatewayRequestHandler,GatewayRequestHandlerOptions,RespondFnin plugin-sdkExample Usage
Inline Buttons
Gateway Methods
Testing
Use Case
Enables the skill-flow plugin to:
🤖 AI-Assisted: Generated with Claude Sonnet 4.5