Update struct represents a single incoming Telegram update. Each update contains exactly one populated field.
Update
Fields
Unique update identifier. JSON:
update_id.New incoming message of any kind — text, photo, sticker, etc.
New version of a message that was edited.
New channel post of any kind.
New version of a channel post that was edited.
A user changed a reaction on a message.
Reactions to a message with anonymous reactions were changed.
Incoming callback query from an inline keyboard. JSON:
callback_query.New incoming inline query. JSON:
inline_query.The result of an inline query chosen by a user. JSON:
chosen_inline_result.New incoming shipping query (requires invoices with flexible pricing).
New incoming pre-checkout query (final confirmation before payment).
New poll state (sent when a poll is stopped or its settings change).
A user changed their vote in a non-anonymous poll.
The bot’s chat member status changed in a chat.
A chat member’s status changed. Requires the
chat_member allowed update type.A request to join a chat was sent.
A chat boost was added or changed. JSON:
chat_boost.A chat boost was removed. JSON:
removed_chat_boost.The bot was connected or disconnected from a business account.
New message from a connected business account.
New version of a message from a connected business account.
Messages were deleted from a connected business account.
A user purchased paid media sent by the bot.
Event Endpoint Constants
Telebot maps update fields to string endpoint constants. Register handlers withb.Handle(endpoint, handlerFunc).
Message Events
| Constant | Trigger |
|---|---|
OnText | Message.Text != "" (non-command) |
OnForward | Message.Origin != nil |
OnReply | Text message that is a reply |
OnEdited | EditedMessage != nil |
OnPhoto | Message.Photo != nil |
OnAudio | Message.Audio != nil |
OnAnimation | Message.Animation != nil |
OnDocument | Message.Document != nil |
OnSticker | Message.Sticker != nil |
OnVideo | Message.Video != nil |
OnVoice | Message.Voice != nil |
OnVideoNote | Message.VideoNote != nil |
OnContact | Message.Contact != nil |
OnLocation | Message.Location != nil |
OnVenue | Message.Venue != nil |
OnDice | Message.Dice != nil |
OnInvoice | Message.Invoice != nil |
OnPayment | Message.Payment != nil |
OnRefund | Message.RefundedPayment != nil |
OnGame | Message.Game != nil |
OnPinned | Message.PinnedMessage != nil |
OnMedia | Any media type not handled by a specific handler |
Channel and Callback Events
| Constant | Trigger |
|---|---|
OnChannelPost | ChannelPost != nil |
OnEditedChannelPost | EditedChannelPost != nil |
OnCallback | Callback != nil (unrouted) |
OnQuery | Query != nil |
OnInlineResult | InlineResult != nil |
OnShipping | ShippingQuery != nil |
OnCheckout | PreCheckoutQuery != nil |
OnPoll | Poll != nil |
OnPollAnswer | PollAnswer != nil |
Group / Chat Events
| Constant | Trigger |
|---|---|
OnAddedToGroup | Bot added to a group |
OnUserJoined | Message.UserJoined != nil |
OnUserLeft | Message.UserLeft != nil |
OnUserShared | Message.UserShared != nil |
OnChatShared | Message.ChatShared != nil |
OnNewGroupTitle | Message.NewGroupTitle != "" |
OnNewGroupPhoto | Message.NewGroupPhoto != nil |
OnGroupPhotoDeleted | Message.GroupPhotoDeleted == true |
OnGroupCreated | Message.GroupCreated == true |
OnSuperGroupCreated | Message.SuperGroupCreated == true |
OnChannelCreated | Message.ChannelCreated == true |
OnMigration | Message.MigrateTo != 0 |
OnMyChatMember | MyChatMember != nil |
OnChatMember | ChatMember != nil |
OnChatJoinRequest | ChatJoinRequest != nil |
Forum Topic Events
| Constant | Trigger |
|---|---|
OnTopicCreated | Message.TopicCreated != nil |
OnTopicReopened | Message.TopicReopened != nil |
OnTopicClosed | Message.TopicClosed != nil |
OnTopicEdited | Message.TopicEdited != nil |
OnGeneralTopicHidden | Message.GeneralTopicHidden != nil |
OnGeneralTopicUnhidden | Message.GeneralTopicUnhidden != nil |
Boost, Business & Other Events
| Constant | Trigger |
|---|---|
OnBoost | Boost != nil |
OnBoostRemoved | BoostRemoved != nil |
OnBusinessConnection | BusinessConnection != nil |
OnBusinessMessage | BusinessMessage != nil |
OnEditedBusinessMessage | EditedBusinessMessage != nil |
OnDeletedBusinessMessages | DeletedBusinessMessages != nil |
OnPurchasedPaidMedia | PurchasedPaidMedia != nil |
OnWebApp | Message.WebAppData != nil |
OnProximityAlert | Message.ProximityAlert != nil |
OnAutoDeleteTimer | Message.AutoDeleteTimer != nil |
OnVideoChatStarted | Message.VideoChatStarted != nil |
OnVideoChatEnded | Message.VideoChatEnded != nil |
OnVideoChatParticipants | Message.VideoChatParticipants != nil |
OnVideoChatScheduled | Message.VideoChatScheduled != nil |
OnWriteAccessAllowed | Message.WriteAccessAllowed != nil |
All Telebot endpoint constants begin with the
\a (alert) character to avoid collision with real command strings.AllowedUpdates
AllowedUpdates is a package-level slice listing all update type strings you can request from the Telegram API:
LongPoller.AllowedUpdates to limit which update types are delivered to your bot:
LongPoller
Limit sets the maximum number of updates to fetch per request (1–100). Timeout is the long-poll timeout in seconds.
MiddlewarePoller
Poller and drops updates for which Filter returns false. Useful for spam filtering or allowlisting specific chats.