TelegramPHP Documentation

Event
in package

FinalYes

This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.

Do not edit it by hand - run composer spec:build instead.

The update types a bot can receive, which are also the event names Telegram emits:

$telegram->on(Event::MESSAGE, function (Message $message) {
    $message->reply('hello');
});

The same strings go in the allowed_updates array of getUpdates and setWebhook; all() is the full list.

Tags
link
https://core.telegram.org/bots/api#update
since

v10.3

Table of Contents

Constants

BUSINESS_CONNECTION  : mixed = 'business_connection'
The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot
BUSINESS_MESSAGE  : mixed = 'business_message'
New message from a connected business account
CALLBACK_QUERY  : mixed = 'callback_query'
New incoming callback query
CHANNEL_POST  : mixed = 'channel_post'
New incoming channel post of any kind - text, photo, sticker, etc.
CHAT_BOOST  : mixed = 'chat_boost'
A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.
CHAT_JOIN_REQUEST  : mixed = 'chat_join_request'
A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
CHAT_MEMBER  : mixed = 'chat_member'
A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
CHOSEN_INLINE_RESULT  : mixed = 'chosen_inline_result'
The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
DELETED_BUSINESS_MESSAGES  : mixed = 'deleted_business_messages'
Messages were deleted from a connected business account
EDITED_BUSINESS_MESSAGE  : mixed = 'edited_business_message'
New version of a message from a connected business account
EDITED_CHANNEL_POST  : mixed = 'edited_channel_post'
New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
EDITED_MESSAGE  : mixed = 'edited_message'
New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
ERROR  : mixed = 'error'
Emitted with any error the client could not hand to a caller.
GUEST_MESSAGE  : mixed = 'guest_message'
New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response.
INLINE_QUERY  : mixed = 'inline_query'
New incoming inline query
MANAGED_BOT  : mixed = 'managed_bot'
A new bot was created to be managed by the bot, or token or owner of a managed bot was changed
MESSAGE  : mixed = 'message'
New incoming message of any kind - text, photo, sticker, etc.
MESSAGE_REACTION  : mixed = 'message_reaction'
A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.
MESSAGE_REACTION_COUNT  : mixed = 'message_reaction_count'
Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.
MY_CHAT_MEMBER  : mixed = 'my_chat_member'
The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
PAYLOAD_TYPES  : array<string, string> = ['message' => 'Message', 'edited_message' => 'M...
POLL  : mixed = 'poll'
New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot.
POLL_ANSWER  : mixed = 'poll_answer'
A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
PRE_CHECKOUT_QUERY  : mixed = 'pre_checkout_query'
New incoming pre-checkout query. Contains full information about checkout.
PURCHASED_PAID_MEDIA  : mixed = 'purchased_paid_media'
A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat
READY  : mixed = 'ready'
Emitted once the bot has identified itself and updates are flowing.
REMOVED_CHAT_BOOST  : mixed = 'removed_chat_boost'
A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
SHIPPING_QUERY  : mixed = 'shipping_query'
New incoming shipping query. Only for invoices with flexible price.
STOPPED_MESSAGE_GENERATION  : mixed = 'stopped_message_generation'
A user asked the bot to stop the generation of a message
SUBSCRIPTION  : mixed = 'subscription'
User payment subscription has changed
UPDATE  : mixed = 'update'
Emitted for every update, whatever its type, with the Update part.

Methods

all()  : array<int, string>

Constants

BUSINESS_CONNECTION

The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot

public mixed BUSINESS_CONNECTION = 'business_connection'

BUSINESS_MESSAGE

New message from a connected business account

public mixed BUSINESS_MESSAGE = 'business_message'

CALLBACK_QUERY

New incoming callback query

public mixed CALLBACK_QUERY = 'callback_query'

CHANNEL_POST

New incoming channel post of any kind - text, photo, sticker, etc.

public mixed CHANNEL_POST = 'channel_post'

CHAT_BOOST

A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.

public mixed CHAT_BOOST = 'chat_boost'

CHAT_JOIN_REQUEST

A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.

public mixed CHAT_JOIN_REQUEST = 'chat_join_request'

CHAT_MEMBER

A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.

public mixed CHAT_MEMBER = 'chat_member'

CHOSEN_INLINE_RESULT

The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.

public mixed CHOSEN_INLINE_RESULT = 'chosen_inline_result'

DELETED_BUSINESS_MESSAGES

Messages were deleted from a connected business account

public mixed DELETED_BUSINESS_MESSAGES = 'deleted_business_messages'

EDITED_BUSINESS_MESSAGE

New version of a message from a connected business account

public mixed EDITED_BUSINESS_MESSAGE = 'edited_business_message'

EDITED_CHANNEL_POST

New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

public mixed EDITED_CHANNEL_POST = 'edited_channel_post'

EDITED_MESSAGE

New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

public mixed EDITED_MESSAGE = 'edited_message'

ERROR

Emitted with any error the client could not hand to a caller.

public mixed ERROR = 'error'

GUEST_MESSAGE

New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response.

public mixed GUEST_MESSAGE = 'guest_message'

INLINE_QUERY

New incoming inline query

public mixed INLINE_QUERY = 'inline_query'

MANAGED_BOT

A new bot was created to be managed by the bot, or token or owner of a managed bot was changed

public mixed MANAGED_BOT = 'managed_bot'

MESSAGE

New incoming message of any kind - text, photo, sticker, etc.

public mixed MESSAGE = 'message'

MESSAGE_REACTION

A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.

public mixed MESSAGE_REACTION = 'message_reaction'

MESSAGE_REACTION_COUNT

Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.

public mixed MESSAGE_REACTION_COUNT = 'message_reaction_count'

MY_CHAT_MEMBER

The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.

public mixed MY_CHAT_MEMBER = 'my_chat_member'

PAYLOAD_TYPES

public array<string, string> PAYLOAD_TYPES = ['message' => 'Message', 'edited_message' => 'Message', 'channel_post' => 'Message', 'edited_channel_post' => 'Message', 'business_connection' => 'BusinessConnection', 'business_message' => 'Message', 'edited_business_message' => 'Message', 'deleted_business_messages' => 'BusinessMessagesDeleted', 'guest_message' => 'Message', 'message_reaction' => 'MessageReactionUpdated', 'message_reaction_count' => 'MessageReactionCountUpdated', 'inline_query' => 'InlineQuery', 'chosen_inline_result' => 'ChosenInlineResult', 'callback_query' => 'CallbackQuery', 'shipping_query' => 'ShippingQuery', 'pre_checkout_query' => 'PreCheckoutQuery', 'purchased_paid_media' => 'PaidMediaPurchased', 'poll' => 'Poll', 'poll_answer' => 'PollAnswer', 'my_chat_member' => 'ChatMemberUpdated', 'chat_member' => 'ChatMemberUpdated', 'chat_join_request' => 'ChatJoinRequest', 'chat_boost' => 'ChatBoostUpdated', 'removed_chat_boost' => 'ChatBoostRemoved', 'managed_bot' => 'ManagedBotUpdated', 'subscription' => 'BotSubscriptionUpdated', 'stopped_message_generation' => 'MessageGenerationStopped']

Update field => the part class it carries.

POLL

New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot.

public mixed POLL = 'poll'

POLL_ANSWER

A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.

public mixed POLL_ANSWER = 'poll_answer'

PRE_CHECKOUT_QUERY

New incoming pre-checkout query. Contains full information about checkout.

public mixed PRE_CHECKOUT_QUERY = 'pre_checkout_query'

PURCHASED_PAID_MEDIA

A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat

public mixed PURCHASED_PAID_MEDIA = 'purchased_paid_media'

READY

Emitted once the bot has identified itself and updates are flowing.

public mixed READY = 'ready'

REMOVED_CHAT_BOOST

A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.

public mixed REMOVED_CHAT_BOOST = 'removed_chat_boost'

SHIPPING_QUERY

New incoming shipping query. Only for invoices with flexible price.

public mixed SHIPPING_QUERY = 'shipping_query'

STOPPED_MESSAGE_GENERATION

A user asked the bot to stop the generation of a message

public mixed STOPPED_MESSAGE_GENERATION = 'stopped_message_generation'

SUBSCRIPTION

User payment subscription has changed

public mixed SUBSCRIPTION = 'subscription'

UPDATE

Emitted for every update, whatever its type, with the Update part.

public mixed UPDATE = 'update'

Methods

all()

public static all() : array<int, string>
Return values
array<int, string>

Every update type, for allowed_updates.

On this page

Search results