Simpler method to get chat_id for telegram bot (#11533)

* Simpler method to get chat_id for telegram bot 

I was struggling with getting id some time ago but found this bot and this is the easiest method to get chat_id.
Notice that chat_id is the same for all bots, but you should contact them first

* Remove group ID part

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
This commit is contained in:
Alex Solomaha 2019-12-25 16:34:11 +02:00 committed by Franck Nijhof
parent 7ed45e5adc
commit 561b8c13ec

View File

@ -18,7 +18,9 @@ The requirements are:
- You need to configure a [Telegram bot in Home Assistant](/integrations/telegram_chatbot) and define there your API key and the allowed chat ids to interact with.
- The `chat_id` of an allowed user.
The quickest way to retrieve your `chat_id` is visiting `https://api.telegram.org/botYOUR_API_TOKEN/getUpdates` or to use `$ curl -X GET https://api.telegram.org/botYOUR_API_TOKEN/getUpdates` **after** you have sent the bot a message. Replace `YOUR_API_TOKEN` with your actual token.
**Method 1:** You can get your `chat_id` by sending any message to the [GetIDs bot](https://t.me/getidsbot).
**Method 2:** To retrieve your `chat_id` you can visit `https://api.telegram.org/botYOUR_API_TOKEN/getUpdates` or to use `$ curl -X GET https://api.telegram.org/botYOUR_API_TOKEN/getUpdates` **after** you have sent the bot a message. Replace `YOUR_API_TOKEN` with your actual token.
The result set will include your chat ID as `id` in the `chat` section:
@ -49,7 +51,7 @@ The result set will include your chat ID as `id` in the `chat` section:
}
```
Another way to get your chat ID directly is described below. Start your Python interpreter from the command-line:
**Method 3:** Another way to get your chat ID directly is described below. Start your Python interpreter from the command-line:
```python
$ python3