Get a channel ID or a user ID from a forwarded message: forward a post to a bot and read forward_origin in the update. This works for private channels you can read but not link to, and the inspector below shows when Telegram hides the sender.
Any bot you created with @BotFather. Open a private chat with it and forward the message there.
With your own bot: run the command shown in the inspector.
type channel → chat.id is the channel. type user → sender_user.id is the person. type chat → sender_chat.id. type hidden_user → no ID exists.
Source: Bot API, MessageOrigin.
Paste what getUpdates returned (or a single update or message). Every ID in it is listed. Read in your browser — nothing is uploaded.
1 · Fetch your bot's updates in a terminal# in your own terminal: $TOKEN is your bot's token, which never goes into this page curl -s "https://api.telegram.org/bot$TOKEN/getUpdates"
The public lookup needs an @username. Forwarding works without one. Any post you can see in Telegram can be forwarded to a bot, and the update the bot receives says where the post came from. That makes it the simplest way to get the ID of a private channel you are subscribed to, without adding a bot to it.
You read a private channel and want its ID for an alert bot. Open the channel, forward any post to your own bot, call getUpdates and paste the JSON into the inspector. forward_origin.type is channel, and forward_origin.chat.id is a number starting with -100: that is the channel’s chat_id. forward_origin.message_id is the original post’s ID inside that channel.
People can hide their account in forwards (Settings, Privacy, Forwarded messages). Their messages then arrive as hidden_user with only a display name, for every bot alike. No method recovers the ID from such a forward. Ask the person to write to the bot directly instead; then message.from.id is theirs.
Some clients offer “forward without author” or the bot receives a copy made with copyMessage. A copy carries no origin at all. Use a normal forward.
Bot API 7.0 replaced forward_from and forward_from_chat with forward_origin. An old library may still show the old names, or drop the field. The inspector reads both.
Forward any post of the channel to a bot you control and call getUpdates. message.forward_origin.chat.id is the channel's ID; this also works for private channels you are a member of.
The person has set “Forwarded messages” to hide their account. Telegram then sends forward_origin of type hidden_user with only the display name — there is no ID to read, for any bot.
Bot API 7.0 replaced them with forward_origin, an object whose type is user, hidden_user, chat or channel. Older libraries may still show the old field names; the inspector reads both.
A message written in a group by a person is forwarded as coming from that person, so you get the user's ID (or a hidden user). You get a group's ID only for messages sent on behalf of the group itself, such as anonymous admin posts.
Yes, if you can read it: forward one of its posts to a bot you control and read forward_origin.chat.id. You do not have to add the bot to the channel.
The message was sent on behalf of a group, for example by an anonymous admin. sender_chat.id is the group’s ID.