🎹
Keyboard
Add interactive buttons to your message
Traditional chat bots can of course be taught to understand human language. But sometimes you want some more formal input from the user — and this is where custom keyboards can become extremely useful.
Whenever your bot sends a message, it can pass along a special keyboard with predefined reply options (see ReplyKeyboardMarkup). Telegram apps that receive the message will display your keyboard to the user. Tapping any of the buttons will immediately send the respective command. This way you can drastically simplify user interaction with your bot.
Below is the illustration of how a keyboard looks like.
const keyboard = new Keyboard()
.text("A").text("B").row()
.text("C").text("D");
Bot.reply("Worked", {
reply_markup: keyboard,
});
Here is an example on how to send an inline keyboard in BotMate Script.
const inlineKeyboard = new InlineKeyboard()
.text("Human", "/human")
.text("Bot", "/bot");
Bot.reply("What are you?", {
reply_markup: inlineKeyboard
});
A URL button contains a hyperlink which on clicked opens up in a web browser.
An example of a URL button is illustrated in the image below.

const inlineKeyboard = new InlineKeyboard().url(
"BotMate Documentation",
"https://docs.botmate.app",
);
Bot.reply("Click on the button below", {
reply_markup: inlineKeyboard,
});
A callback button in an inline keyboard sends a callback query not visible to the user when pressed. You can pass a command name in callback data and the command will be executed.
const inlineKeyboard = new InlineKeyboard()
.text("Get random number", "/random").row()
Bot.reply("Worked", {
reply_markup: inlineKeyboard,
});
The above will execute
/random
command when user press the button.Last modified 1yr ago