Why i dont get updates of my telegram bot in api.telegram.org/botToken/getUpdates

48 Views Asked by At

I created a telegram bot and low i need to get my chat id to firce it to write in chat. I added bot in chat, typed url api.telegram.org/botToken/getUpdates and still get responce:

{"ok":true,"result":[]}

I deleted and added it some times but still can't get a chat id

1

There are 1 best solutions below

0
Parvez Alam On

You have to manually add a member to that group/channel and try again this api and you will get the wanted details in the result object.

You can then get the chatId by typing "chat.id".

bot.on('getUpdates', async (msgObj) => {
try {const chatId = msgObj.chat.id;
console.log(chatId);
}
catch (error) { console.error('Error handling msgObj:', error);
}});