Created
September 26, 2021 18:50
-
-
Save irokhes/de03e09e69a1746ce8140e90edeeef16 to your computer and use it in GitHub Desktop.
How to obtain the chat_id of a private Telegram channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You should convert it to public with some @channelName | |
Send message to this channel through Bot API | |
https://api.telegram.org/bot111:222/sendMessage?chat_id=@channelName&text=123 | |
bot+[yoour bot id] | |
As response you will get info with chat_id of your channel. | |
{ | |
"ok" : true, | |
"result" : { | |
"chat" : { | |
**"id" : -1001005582487,** | |
"title" : "Test Private Channel", | |
"type" : "channel" | |
}, | |
"date" : 1448245538, | |
"message_id" : 7, | |
"text" : "123ds" | |
} | |
} | |
Now you can convert Channel back to private (by deleting channel's link) and send message directly to this chat_id "-1001005582487" | |
https://api.telegram.org/bot111:222/sendMessage?chat_id=-1001005582487&text=123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment