Skip to main content

Inline buttons

The Inline Keyboard - is a keyboard attached to a chat message, it can be used to interact with the bot instead of sending messages (commands) from the regular lower keyboard.

@MenuBuilderBot allows you to attach inline buttons to bot messages. This tutorial will help you work with inline buttons (keyboard). This guide describes the types of inline buttons and how to use them.

3 inline buttons under EACH message are available initially in each bot. The number of inline buttons under the message can be increased.

Functionality of «🧩Extensions» section: if you need more than 3 inline buttons under each message.

Extra Inline Buttons.
To connect, go in your bot:
☞ 🔐Admin | 🧩Extensions | 📂Buttons


What is Inline buttons (keyboard)


Currently there are 3+1 - total 4 types of inline buttons in @MenuBuilderBot:
● URLs (links)
● Pop-up window
● Commands
WebApp-URL (activated separately - see below)

IMG_20221117_111409.jpg

WebApp-URL is a functionality of «🧩Extensions» section: buttons allow you to launch website pages and web applications inside Telegram. Applications and websites launched in a pop-up window.

WebApp-URL
To connect, go in your bot:
☞ 🔐Admin | 🧩Extensions | 📂WebApp

❖ How to add inline buttons

1. Go to the «Post Editor» and create a message (as usual) or use a ready-made message for this.

2. Go to «Message settings» by clicking on the button with an asterisk ("*"):


IMG_20221117_112256.jpg


3. Click «➕ Inline Button» to add the FIRST inline button.


IMG_20221117_112352.jpg


This is how the creation of the FIRST message button will look like. If the message have already gotten a button beneath, then adding of the new ones will continue using a special editor (see below).

4. Select the desired mode.


IMG_20221117_112939.jpg


5. Create a message with two or more lines (depending on the selected mode).

The first line will ALWAYS be the title of the button.
The second and other lines may have different values ​​depending on the mode in which the inline button is created. Features of the second line for each of the Modes - see below.


Inline button modes

Mode 1: URL or Share button

The second line must contain a valid address (URL). For example:


IMG_20221117_113425.jpg


Valid URLs start with:
https://
http://
t.me/

When a user presses such a button, depending on the type of link, the URL specified in the button will be opened (for links to external sites), or he will be prompted to share the link in a chat of his choice (for internal Telegram "Share" links).


Examples of share links for referrals:

Share on Telegram:
https://t.me/share/url?url=%reflink%

Share VK:
https://vk.com/share.php?url=%reflink%

Share on Twitter:
https://twitter.com/intent/tweet?url=%reflink%

Share Odnoklassniki:
https://connect.ok.ru/offer?url=%reflink%

Share Facebook:
http://www.facebook.com/share.php?u=%reflink%

Where %reflink% - is a macros containing a referral link, can be replaced with the data you need.

Some Telegram clients also support adding a comment to such a links:
https://t.me/share/url?url=https://t.me/MenuBuilderBot&text=Bots+Constructor+in+Telegram
Spaces in the comment should be replaced with "+" plus signs.


Mode 2: Pop-up window

The second and other lines must contain text (no more than 200 characters) that will be shown in the pop-up window. For example:


IMG_20221117_114656.jpg


When it comes to "Lines" - it means "line breaks" - that is, lines starting with the "New Line", and not just like one long line.

When the user clicks such a button, the text specified in it will be shown in a similar pop-up window.


IMG_20221117_115156.jpg


Mode 3: Command

The second line should contain the actual command assigned to any of your bot's menu buttons (detailed guide on Commands see by the link).

In addition to commands assigned to buttons, you can use commands:
/home
to access your bot's Main Menu.

/start
will work like a regular /start command sent to the bot.

For example:


IMG_20221117_115657.jpg


When the user presses such an inline button, they will be shown the button's messages with the corresponding command.

Now you know how to create inline buttons in each mode!


IMG_20221117_111409.jpg



❖ Inline button editor


After creating the first inline button under the message, work with inline will continue using a special editor.

In the picture below, an example of the editor and three buttons created - one for each inline mode.




In order for you in the editor to be able to determine the Mode in which one or another button works, a special letter suffix is ​​added to the name of each of them.
[u] - (URL) URL mode
[d] - (Dialog) Popup window mode
[c] - (Command) Command mode

● The default mode, when you enter the message inline buttons settings, will be «Add» mode.
● Each Editor Mode is identified by its own symbol in the button's name.
● Switch to the appropriate mode and perform its inherent actions with one click on the desired button.


Editor mode «Add»

Allows you to add a new button to the existing ones.

● To add a new button Click on one of the existing ones.
● The new Button will be added one line below the button you have clicked to add.
● The new button will take up the entire line.


Editor mode «Move»

Allows you to move the buttons in the menu.

● Pressing the button will move it one position to the left.
● If the button is in the leftmost position, it will move up one line.
● After moving to a new line, the button will occupy the entire line.


Editor mode «Delete»

Allows you to remove buttons in the menu.

● Click the button to delete.
● The data of the removed button will be saved in the chat history as a message.


Editor mode «Edit»

Allows you to change any data of the created button.

● Click the button to edit.
● You can change both, the Mode in which the button works and its data.


❖ How to remove an inline button


For information about the «Delete» editor mode, see above. This is a duplicate note for those too lazy to read the entire document at least once.

• Go in your bot:
☞ Post Editor.
• Press the lower menu button containing the message whose inline button you want to delete.
• Press the inline button with an asterisk (*) below this message to access its Settings.
• Press the required inline button to delete it.
• Switch to «Delete» editor mode.
• Press the button you want to delete.

If you are already in the inline button editor and all buttons are marked with a cross, then you can simply click on the button you want to delete.

The deletion info message will show the data of the deleted button. If necessary, you can copy it and create the button again, making the necessary changes if need be.


IMG_20221117_121901.jpg



Remove inline menus and messages from chat history


A message with inline buttons of the "Command" type can be deleted automatically after the user clicks on such button. By default it is NOT deleted.

The function is made in order not to confuse the user with irrelevant buttons scattered in the chat body. It allows you to automatically delete used menus (and messages to which it is attached), allowing you to avoid unwanted clicks in future.

At the time we writing this manual, there are 3 types of inline buttons available in the bot: Url / Share, Pop-up window, Command. The first two types of buttons, when pressed, do not cause the appearance of any additional messages in the chat with the bot. At the same time, inline buttons with Command, in the overwhelming majority of cases, containing messages, the appearance of which in the chat inevitably causes its inline menu to "slide" - making it irrelevant, useless or just not convenient to use.

It should be noted that the inline menu in Telegram cannot exist by itself - it MUST be attached to any message. When deleting an inline menu, the message to which it is attached will also be deleted.

In general, this message describes, explains, or contains data that can be changed by the buttons of its inline menu and has no meaning without the menu itself. Technically, it is possible to delete the inline menu without deleting the messages, but this behavior is not required, that is why out of these two options, was selected the one, that was actually selected. )

Deleting an inline menu works in 2 modes:
1 - deletes the message with inline itself.
2 - deletes the message with inline itself and the message before it (what ever message it would be).

In some cases the result of deletion may be unpredictable, thus the mode you require, most often, needs to be selected empirically.

To configure the «Delete Inline» menu, go in your bot:
☞ 🔐Admin | ⚙️Bot Settings


Errors while working with inline buttons


ERROR: You have not used the bot for some time and when you click on the inline button (or the regular button of the lower menu), the bot takes you to the "Main Menu".

REASON: The bot's working sessions are always terminated after 30 minutes of inactivity. At the same time, for security reasons, any "closed" (by condition, captcha, etc.) sections of the bot become inaccessible. You can get in there only by going again all the way through the button that actually closes the entrance. Thus, if the inline-button (or the regular button of the lower menu) is located or leads to such a "closed" section, the bot will not allow it to work until the user enters this section again through the button that actually closes the entrance.

SOLUTION: This behavior of the bot is the safest and there are no plans to change this mechanic in the near future. There is no solution as such.

• • •

ERROR: You have created a new Inline-button in command mode which leads to the depth of the lower menu and it does not show the required message.

REASON: The lower menu button accessed by the inline-button's command is inside the "closed" area of the bot. It is not possible to access the closed area from the outside. This ensures the safety of closed areas.

SOLUTION: "Move" (or duplicate) the addressee button from the closed area of the bot, for example, to the "Main Menu" and place the necessary condition on it. The button itself must be made hidden from the user - either as Admin Only or as Invisible.


❖ Error messages

 

❌ Unknown operation code.

You have added an Inline button with a Command, and when you try to click on this button, you get the following message. Check that your command does not start with one of the reserved names:
/get_

 

❖ Additional information


Batch creation of inline buttons

Available for Share/URL and Command buttons. This option extends the capabilities of the Inline Button Editor by simplifying and speeding up the process of creating new buttons. All actions are performed by sending ONE message to the bot.

To batch create inline buttons, you need the extension:

Advanced Modes for Adding Buttons
To connect, go to your bot:
☞ 🔐Admin | 🧩Extensions | 📂Optimization