If you’re a developer and working on a Telegram chat bot, you may need to use chat id and user id in order to perform certain actions through your Telegram bot.
But before you start development of your first telegram bot, you must understand what is difference between Telegram chat id and user id. In this article, I am going to explain the difference between telegram chat id and user id. So let’s start the comparison of Telegram chat id vs. user id.
Difference between Telegram Chat ID and User ID
Telegram Chat ID is an unique identification number of a Telegram chat(personal/group chat). However the Telegram User ID is a unique identification number of a particular Telegram user.
Telegram Chat ID helps telegram to identify your Telegram chat groups even if you change name and username of Telegram Group. Similarly, Telegram user id is used to identify the user even if he/she changes their username and name.
Telegram chat id and user id used to perform certain actions by Telegram bot like sending a message in Telegram chat, taking action on a particular user in Telegram group.
How to know your Chat ID?
1. Create a Telegram bot
2. Open api.telegram.org/bot<bot_token>/getUpdates in browser
3. Find chat in json response and then note down its id value that’s your chat id
How to get your user id?
1. Search @userinfobot
2. Start the Bot
3. It will send your User ID
How to find someone else’s user id?
1. Create a Telegram group
2. Add that user and any Telegram bot to that bot
3. Ask anything to that user in chat so they send a message
4. Open api.telegram.org/bot<bot_token>/getUpdates in browser
5. Find for that message in JSON response
6. Find the user who send it and you’ll get user id of that Telegram user
I hope you understand the difference between Telegram chat id and user id. If you still have any doubts or need any kind of help ask in comments or DM me on Twitter.