How to get the id of a group in telegram

1

Hi, I want to take the ID of a group in a telegram to be able to use a small application in telegram that I have done, but at the moment I do not know how. For example, this group:

https://telegram.me/joinchat/Ag2Zdj2NIFy3WPs0QP9Fjg

I am making a small application for telegram using the Google api to translate text from any message into a language that the user chooses. But I do not know how I can get the group id. Try following the steps of one of stackoverflow post

But when I do what is detailed there that is the following with the group:

https://api.telegram.org/botAg2Zdj2NIFy3WPs0QP9Fjg/getUpdates

Return me:

{"ok":false,"error_code":404,"description":"Not Found"}

How could I fix it to get the group id?

    
asked by jeronimo urtado 10.04.2017 в 14:07
source

2 answers

2

Your error is in the Token you place. It is missing a part.

The URL must be in the format:

https://api.telegram.org/bot@@@@@@@@@:########################/getUpdates

Where there are 9 arrobas (@) and 35 numerals (#).

The Token that you placed does not have that many characters.

Remember that the Token of your Bot must ask the @BotFather, the Telegram Robot that allows you to create other Bots.

If you notice well you shared (in part) the Token of your BOT, remember that this can be harmful for you, editalo.

The API response should look something like this:

Where you will return the Group ID you need.

    
answered by 10.04.2017 / 14:43
source
0

Another simple way to get the id of the Telegram chat is by entering the application via the web ( Telegram Web ) , we look for the group that we want to know its id and we are going to look for in the URL of the page, the following parameter sent by GET

"...p=sXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXX..."

(Donde X son números)

We take the first 10 numbers in the string before the underscore, after the "s" and we only add a "-100" before and that's the id of the group.

Example:

Para ...p=s1234567890_XXXXXXXXXXXXXXXXXXXX... <br>
idChat= -1001234567890

I occupy bots to send messages to my telegram groups via NodeJS.

    
answered by 18.08.2017 в 23:57