Telegram buttons

We recommend that you read the article Button.

You can use both reply buttons (regular or keyboard buttons) and Inline buttons (buttons in the text) in Telegram.

Important: button limitations

Please be aware of the following platform restrictions when creating buttons:

  • Reply buttons (keyboard): maximum of 12 buttons per row.

  • Inline buttons: Maximum of 8 buttons per row.

  • Button text: Limited to 32 characters.

  • Button color: cannot be customized. Buttons use the default platform style.

How to create a button in block

To create any button in a chatbot, go to the block settings and click on the "Buttons" tab:

Then the settings for adding and editing the button will open. Then click Add:

A settings window will open, allowing you to define the button's label, action, and additional options.

The following button types are only available for the Telegram bot:

  • Share button – allows users to share content.

  • Callback button – sends a silent callback query to your bot.

  • Telegram WebApp – opens a mini-application (e.g., a widget or website) within Telegram.

  • Telegram login – authorizes users via their Telegram account.

There are also other buttons available in Telegram, such as payment, request a phone number or geolocation, and send a link.

Share button

When creating the button, select "Share (Telegram only)" and fill in the fields (optional additional text field):

This button lets you forward the information by selecting a contact from your list.

Enter the URL you wish to share in the button's "Share link" field.

Once a contact is selected, the content from the "Share link" and "Additional text" fields will be sent. Use this to share links to Telegram channel posts and other content.

Attention! It may not work correctly on some iOS devices.

Website login button

For the login button to function, your bot must first be authorized for the target domain. This configuration is done through @BotFather.

Steps to configure:

  1. Open a chat with @BotFather.

  2. Select your bot from the list.

  3. Choose Bot Settings > Domain and add your website's domain.

Next, go to the Domain button:

Note: The button will read Edit domain if a domain exists, or Set domain if one needs to be added.

You will be prompted to set up the domain for your bot:

Correct domain format:

Enter your domain as mavibot.ai or as yourdomain.com if you have a website connected to MaviBot.

Next step:

Once your domain is verified and configured, you can proceed to create the authorization button.

In the Text field, enter the label that will appear on the button.

Then, provide the URL of the page in the Link field where the authorization will take place.

The remaining fields will be needed if a separate bot is used for authorization (you need to get permission to send messages for this bot): in particular, you will need to specify the name of the bot.

If you need to be able to send messages from the specified bot, then be sure to check the box for "Request permission from the user to send messages from the bot":

Telegram login button

Callback button

Callback button is a feedback button when the client sees one thing, and in the bot we get the callback we need to launch any block of the funnel.

It's quite simple to create it: in the Buttons field, click the Add button. In the form that opens, enter the text, specify the type - Callback button (Telegram) and enter the Callback text that should return when you click on the button:

Visually, the button looks like a regular inline button:

After clicking on the button, you will see the configured Callback in the client's card:

It is important!

Telegram does not support Callback keyboard buttons.

Please note!

If the "Callback" button type is selected, the button will display as a callback only if the text of the button differs from the text of the callback.

Telegram Web Application button

This button allows you to open the website as a web application in Telegram.

When adding the button, specify its label, select the type of Telegram Web App button, and provide the link to the website that will open as a web application:

  • You can specify a link through a variable:

Using a variable for a link is highly practical when the target page or website address changes frequently.

How it works:

  1. Define a variable (e.g., landing_page_url) in your project settings.

  2. Reference this variable (e.g., #{landing_page_url}) in all Web App buttons throughout your flows.

Benefit: instead of manually updating the URL in every individual button block, you only need to change the variable's value once in the project settings, and all buttons will automatically update.

Alternative: you can, of course, still specify a direct, static URL directly in the button settings.

How to create buttons for Telegram API functions

While working directly with the Telegram Bot API can be challenging, especially for beginners, MaviBot offers a much more accessible alternative.

Method: use generated code

You can utilize the pre-generated button code from the advanced settings, eliminating the need to write API calls manually.

Steps:

  1. Navigate to your block settings and open the Buttons section.

  2. Use the interface to add and configure all your required buttons (text, links, functions).

  3. The system will automatically generate the correct Telegram API code in the background.

This approach allows you to create complex keyboards visually while the platform handles the underlying technical implementation.

Click "Advanced Settings" to view the generated Telegram API code for your buttons.

Test your buttons, then copy the generated code from Advanced Settings into a variable like buttons.

This function sends a message via the Telegram API with the following parameters: tg_send_message (platform_id, text,client_message_id, reply_markup, sparse_mode, disable_web_page_preview, protect_content, disable_notification, message_thread_id, entities):

Pass the buttons variable to the function in the reply_markup parameter:

Your buttons will appear in the chat with the layout and style you defined.

How to delete reply buttons

While keyboard buttons typically disappear automatically, they can sometimes remain visible.

To forcefully clear lingering reply buttons, insert the following code into the Advanced Settings field:

This empty button configuration instructs Telegram to hide the custom keyboard.

Keyboard menu buttons in Telegram

Keyboard buttons

To be able to use the keyboard buttons (reply) as a permanent Telegram menu, it is enough to assign any value to the variable tg_permanent_reply_buttons (the variable is declared a constant of the project).

Variable: tg_permanent_reply_buttons

Setting the tg_permanent_reply_buttons variable gives you full manual control over the visibility of the reply keyboard (buttons below the message). All automatic hiding behavior by the platform is disabled.

Scope: this setting applies to all reply buttons created in the bot while the variable is active.

Reverting to automatic behavior

To restore the standard automatic keyboard hiding:

  1. Remove the tg_permanent_reply_buttons variable from your project settings.

  2. Recreate any reply buttons that were originally made while the variable was active. Buttons created under the "permanent" rule retain that state and must be recreated to inherit the new, automatic behavior.

How to create a menu in Telegram

The one who created the Telegram bot can make such a menu.

To do this, write to Botfather in Telegram.

Enter the /mybots command, and the list of your bots opens. Choose the one you need. A menu opens for you. Here you need to select Edit Bot, and then Edit Commands.

Enter all commands and their descriptions in a single message, using lowercase letters for command names. You will receive a confirmation when the list is updated.

You can now see and use the menu in your Telegram chat with the bot.

When you click on the menu button, a list of commands that were previously registered in BotFather will open:

Next, go to Mavibot, open the project to which this telegram bot is connected.

Create the Start or Trigger blocks, write commands in the conditions, and in the "Message text" field — the texts that will be received in response.

Example:

How to combine two types of buttons

Create a block with a reply button (keyboard), which you need to visualize.

Create the next block (a timer of 0 seconds) with inline buttons (buttons in the text), which must be placed without removing the reply buttons. For example: [{"type": "inline", "text": "BUTTON NAME", "line": 0, "index_in_line": 0}]

Here is the result:

Last updated