WordPress Telegram Bot - Rules - Callbacks


Callbacks

Back to User Guide


What This Rule Does

The WordPress Telegram Bot allows you to define callbacks for your telegram bot. Callback is a mechanism used in Telegram bots to handle interactive elements such as inline keyboards.

Note: this feature was introduced in version 1.1.2 of the WordPress Telegram Bot plugin.

Example of using callbacks in inline keyboard:

Example of using callbacks in inline keyboard - WordPress Telegram Plugin
Example of using callbacks in inline keyboard

Setting Up

Form for creating a callback - Telegram WordPress Widget
Form for creating a callback
  • Callback Name - Add a callback name. The name should be without spaces. The name can contain underscore "_", for example: "callback_1" or "callback_abc" etc. The callback name should be unique.
  • Callback Code - Place here code or a shortcode.

You can create multiple callbacks and then use them in the Inline Keyboard.

Example

Let's create two callbacks which apply the shortcode from a third-party plugin:

  • enable_map_api - This callback will enable the Map API.
  • disable_map_api - This callback will disable the Map API.
Examples of callbacks - Telegram Plugin for WordPress
Examples of callbacks

Now let's head to the Keyboard Buttons tab.

Navigation to the Keyboard Buttons tab - Telegram Group Bot Manager
Navigation to the Keyboard Buttons tab

Let's create an Inline Keyboard with 2 buttons.

TIP

Learn more about creating and configuring Keyboard Buttons in this guide: WordPress Telegram Bot - Rules - Keyboard Buttons

For each button here you need to define the following:

  • Label - Define the text that will be displayed in the button.
  • Action - Choose the action type. A few options are available, you need to choose here Callback.
  • Content - Add here the Callback name which you define in another tab.
Adding callback buttons to the inline keyboard - Telegram Bot Plugin for WordPress
Adding callback buttons to the inline keyboard

Result in Telegram:

Example of using callbacks in inline keyboard - WordPress Telegram Bot
Example of using callbacks in inline keyboard

More information about the WordPress Telegram Bot plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.