update_type¶
A plain string that tells you what just happened — no detective work required.
What is it?¶
update_type is a string naming the kind of Telegram update that triggered your command. Instead of poking through the entire update object asking "was it a message? a button? a poll?", you get a clean label like "message" or "callback_query".
It's the difference between reading a novel and reading the chapter title. Sometimes you need the novel. Often the title is enough.
When would you use it?¶
Use update_type whenever your command handles more than one kind of event and you need to branch:
- Echo text messages but ignore photos
- Route callback buttons to different logic
- Detect webhook traffic vs normal Telegram updates
- Skip processing for update types your command doesn't care about
Pair it with request — update_type tells you what, request gives you the details.
Try it¶
if (update_type === "message") {
Bot.sendMessage("You wrote: " + message)
}
if (update_type === "callback_query") {
Bot.sendMessage(request.from.id, "Button pressed: " + request.data)
}
if (update_type === "web_request") {
res.send({ status: "ok" })
}
Common values¶
Messages¶
messageedited_messagechannel_postedited_channel_postbusiness_messageedited_business_message
Interactive¶
callback_query— inline keyboard button taps (Handling Callbacks)inline_querychosen_inline_result
Members and chats¶
chat_membermy_chat_memberchat_join_requestchat_boostremoved_chat_boost
Everything else¶
poll,poll_answermessage_reaction,message_reaction_countshipping_query,pre_checkout_querypurchased_paid_mediabusiness_connection,deleted_business_messagesmanaged_botguest_message
HTTP-triggered¶
If the type can't be determined, the value is "unknown". The universe is mysterious sometimes.
Good to know¶
update_typeis read-only and exists only during command execution- Values match Telegram update type names where applicable
- For quick text-only checks,
messageis even simpler — but only works for text messages