Standard keyboard

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.

We currently support text and emoji for your buttons.

You can define a different keyboard for your commands and a global one in plugin options that will be used as a fallback.

Plugin markup

The markup is simple: rows are separated by “;” while columns by “,”.

Example: Hello,Hello2;Hello3

Inline keyboard

There are times when you’d prefer to do things without sending any messages to the chat. For example, when your user is changing settings or flipping through search results. In such cases you can use Inline Keyboards that are integrated directly into the messages they belong to.

Unlike with custom reply keyboards, pressing buttons on inline keyboards doesn’t result in messages sent to the chat. Instead, inline keyboards support buttons that work behind the scenes: callback buttons, URL buttons and switch to inline buttons.

You can define an inline keyboard for your commands. The markup is made in a simple json-way that gives you enough flexibility.

3-row example

[[{“text”:”text 1″,”callback_data”:”1″},{“text”:”Some button text 2″,”url”:””},{“text”:”Some button text 3″,”callback_data”:”3″}]]

2-row, 2+1 columns

[[{“text”:”Text 1″,”callback_data”:”1″},{“text”:”Link 1″,”url”:””}],[{“text”:”Text2″,”callback_data”:”2″}]]