Skip to main content

InlineKeyboardButton

This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.

📝 Schema

FieldTypeDescription
textstringLabel text on the button
urlstringOptional. URL to be opened when the button is pressed.
callback_datastringOptional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes

⚙️ Get methods

getText()

Retrieves the label text of the button.

$text = $inlineKeyboardButtonObject->getText();

getUrl()

Checks if the button contains a URL. If the button opens a URL when pressed, this method returns the URL string. If not, it returns null.

$url = $inlineKeyboardButtonObject->getUrl();

getCallbackData()

Checks if the button contains callback data. If the button sends callback data when pressed, this method returns the data string. If not, it returns null.

$callbackData = $inlineKeyboardButtonObject->getCallbackData();

➕ More

tip

For further information, refer to the official Bale documentation for more details.