You can not get all chatId's by Telegram API. See official docs.. I think best solution there is to store all chatId's in database or file. You can get chatId from update variable from method public void onUpdateReceived(Update update) when user starts the bot or execute some actions:
Hiển thị thông tin cá»§a Telegram Bot Raw, bạn copy ID group như phần ná»™i dụng ảnh hướng dẫn Lưu ý: bạn cần thêm con BOT đã tạo và o Group nháºn dữ liệu cá»§a bạn ở Telegram.
Get Telegram Chat ID : https://codesandbox.io/s/get-telegram-chat-id-q3qkk. Use the tool above to get the Chat ID of the group that your Bot is a member of. Instructions. Install
Create a bot on Telegram app, and get the bot token. For tracking Channels or Groups, @channel name or @group name is required. However you can also use chat_id, i.e. -1001615491316. chat_id is required in case of private group or channel. Bot must not be banned in the Group or Channel. Add the bot if the group or channel is private.
This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1 ). If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct
As I know, there is no way. When you chat with a friend, is there any way to know that he/she has deleted the chat page of you? NO. Telegram bot is completely similar to simple chat in this case up to this date. It doesn't have considered in Telegram Bot API up to this date.
.
chat id bot telegram