CallbackQuery
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present.
📝 Schema
Field | Type | Description |
---|---|---|
id | string | Unique identifier for this query |
from | User | Sender |
message | Message | Optional. Message sent by the bot with the callback button that originated the query |
data | string | Optional. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. |
⚙️ Get methods
getId()
Retrieves the unique identifier for the callback query.
$queryId = $callbackQueryObject->getId();
getFrom()
Retrieves the sender of the callback query, which is a User object.
$user = $callbackQueryObject->getFrom();
getMessage()
Checks if the callback query originated from a message sent by the bot. If present, it retrieves the Message object.
$message = $callbackQueryObject->getMessage();
getData()
Retrieves the data associated with the callback button, which is a string.
$data = $callbackQueryObject->getData();
➕ More
tip
For further information, refer to the official Bale documentation for more details.