Interactive Keyboards in BJS
What are Keyboards?
Keyboards allow users to interact with your bot by clicking buttons instead of typing commands. This makes your bot more user-friendly and accessible.
Simple Keyboard Example
JAVASCRIPT
var keyboard = [
[{text: "đ Search", callback_data: "search"}],
[{text: "đ Categories", callback_data: "categories"}],
[{text: "âšī¸ Help", callback_data: "help"}]
];
Bot.sendInlineKeyboard(keyboard, "What would you like to do?");
Multi-Row Keyboards
JAVASCRIPT
var keyboard = [
[{text: "đĨ Popular", callback_data: "popular"}, {text: "⨠New", callback_data: "new"}],
[{text: "đ Categories", callback_data: "categories"}, {text: "đˇī¸ Tags", callback_data: "tags"}],
[{text: "âī¸ Settings", callback_data: "settings"}]
];
Bot.sendInlineKeyboard(keyboard, "Browse content:");
URL Buttons
JAVASCRIPT
var keyboard = [
[{text: "đ Documentation", url: "https://help.bots.business"}],
[{text: "đŦ Support Chat", url: "https://t.me/botsbusiness"}]
];
Bot.sendInlineKeyboard(keyboard, "Need help?");
đ Source
This tutorial is based on the official Bots.Business Documentation. Visit their site for the most up-to-date information and advanced guides.