I want to implement Telegram so I can send push notifications to my phone.
I did everything, I have a bot now. However when I want to get the chat id of the bot I get (/getUpdates):
It’s not easy
You will find the answer on telegram blogs and website
I struggled but I can’t remember how I did it
I remember getting the same json reply as you as then I googled
and googled and googled and tried many things until I found the answer
Sorry I can’t help more
I figured it, so I will note down here for the other.
Seem like at the moment (11/2023), the way to get chat ID from API https://api.telegram.org/bot<YourBOTToken>/getUpdates is not working. So here is my way:
Create channel
Add bot then make it admin
Make channel public, give it a link
Try to make request to this Telegram API: https://api.telegram.org/bot[your bot id]/sendMessage?chat_id=@[your public channel url]&text=[your message]
After testing success, your can set the channel to private and still can use your channel public url link like your chatId. UPDATED: My misstake, you can not use bot to send to your private channel. It have to be public
Update image when I create ChatId for channel by make it public