Skip to content

feat(telegram): add inline keyboard buttons support#2515

Closed
mkeizer wants to merge 1 commit into
nanocoai:mainfrom
mkeizer:feat/telegram-inline-buttons
Closed

feat(telegram): add inline keyboard buttons support#2515
mkeizer wants to merge 1 commit into
nanocoai:mainfrom
mkeizer:feat/telegram-inline-buttons

Conversation

@mkeizer
Copy link
Copy Markdown

@mkeizer mkeizer commented May 16, 2026

Summary

  • Adds InlineButton and SendMessageOptions types for generic button support
  • Updates the send_message MCP tool with an optional buttons parameter (array of rows)
  • Passes buttons through the IPC pipeline to the Telegram channel
  • Builds Grammy's InlineKeyboard from the button data and attaches to outgoing messages
  • Handles callback_query:data events — delivers button clicks as [button_click:<id>] messages to the agent

How it works

Agent sends a message with buttons:

{
  "text": "Deploy to production?",
  "buttons": [[
    {"text": "✅ Approve", "id": "approve_deploy"},
    {"text": "❌ Reject", "id": "reject_deploy"}
  ]]
}

User sees an inline keyboard in Telegram. When they click a button, the agent receives:

[button_click:approve_deploy]

Test plan

  • All 201 existing tests pass
  • TypeScript typecheck passes (tsc --noEmit)
  • Manual test: send message with buttons, verify keyboard appears
  • Manual test: click button, verify callback delivered as message

🤖 Generated with Claude Code

Adds the ability for agents to send messages with inline buttons
(Telegram InlineKeyboard). When a user clicks a button, the click
is delivered as an inbound message with [button_click:<id>] format.

Changes:
- types.ts: Add InlineButton, SendMessageOptions interfaces
- ipc.ts: Pass buttons through IPC message pipeline
- index.ts: Route buttons from IPC to channel.sendMessage()
- telegram.ts: Build InlineKeyboard from button data, handle
  callback_query events and deliver clicks as messages
- ipc-mcp-stdio.ts: Add optional buttons parameter to send_message tool

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant