name: build-reply-keyboard description: Builds reply keyboards for messages using the telegram-bot DSL. Use when adding persistent or one-time keyboards, request contact/location buttons, or Web App buttons for user input.
Build Reply Keyboard
Quick Start
Use replyKeyboardMarkup { } or replyKeyboardMarkup(block). Attach via markup() or replyKeyboardMarkup { } on send actions.
message("Choose an option:")
.replyKeyboardMarkup {
+"Option A"
+"Option B"
newLine()
"Share contact" requestContact true
options { resizeKeyboard = true; oneTimeKeyboard = true }
}
.send(user, bot)
Simple Buttons
Use unary plus to add plain text buttons:
+"Button 1"
+"Button 2"
newLine()
+"Next row"
Special Buttons
| Type | Syntax | Availability |
|---|---|---|
| Request contact | "Share contact" requestContact true |
Private chats only |
| Request location | "Share location" requestLocation true |
Private chats only |
| Request user | "Select user" requestUser KeyboardButtonRequestUsers(...) |
Private chats only |
| Request chat | "Select chat" requestChat KeyboardButtonRequestChat(...) |
Private chats only |
| Request poll | "Create poll" requestPoll KeyboardButtonPollType(...) |
Private chats only |
| Web App | "Open app" webApp "https://..." |
Private chats only |
Options
Configure via options { }:
resizeKeyboard = true— keyboard resizes to fit screenoneTimeKeyboard = true— keyboard hides after one useinputFieldPlaceholder = "Type here..."— placeholder in input field (1-64 chars)selective = true— show only to @mentioned users or reply targetisPersistent = true— keyboard stays visible (for oneTimeKeyboard)
Rows
Use newLine() or br() to start a new row, same as inline keyboards.
Removing the Keyboard
When done, send a message with replyKeyboardRemove():
message("Keyboard removed")
.replyKeyboardRemove()
.send(user, bot)
Or replyKeyboardRemove(selective = true) for selective removal.