mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 18:36:51 +00:00
Change ordering (as proposed in #724)
This commit is contained in:
parent
794daeaabc
commit
defccd6f4a
@ -20,16 +20,7 @@ The requirements are:
|
||||
- You need a [Telegram bot](https://core.telegram.org/bots). Please follow those [instructions](https://core.telegram.org/bots#botfather) to create one and get the token for your bot. Keep in mind that bots are not allowed to contact users. You need to make the first contact with your user. Meaning that you need to send a message to the bot from your user.
|
||||
- The `chat_id` of an user.
|
||||
|
||||
An easy way to get your chat ID is described below:
|
||||
|
||||
```python
|
||||
import telegram
|
||||
bot = telegram.Bot(token='YOUR_API_TOKEN')
|
||||
chat_id = bot.getUpdates()[-1].message.chat_id
|
||||
print(chat_id)
|
||||
```
|
||||
|
||||
Another way to retrieve your `chat_id` is visiting [https://api.telegram.org/botYOUR_API_TOKEN/getUpdates](https://api.telegram.org/botYOUR_API_TOKEN/getUpdates).
|
||||
The quickest way to retrieve your `chat_id` is visiting [https://api.telegram.org/botYOUR_API_TOKEN/getUpdates](https://api.telegram.org/botYOUR_API_TOKEN/getUpdates).
|
||||
|
||||
The result set will include your chat ID as `id` in the `from` section:
|
||||
|
||||
@ -47,6 +38,16 @@ The result set will include your chat ID as `id` in the `from` section:
|
||||
...
|
||||
```
|
||||
|
||||
Another way to get your chat ID directly is described below:
|
||||
|
||||
```python
|
||||
import telegram
|
||||
bot = telegram.Bot(token='YOUR_API_TOKEN')
|
||||
chat_id = bot.getUpdates()[-1].message.chat_id
|
||||
print(chat_id)
|
||||
123456789
|
||||
```
|
||||
|
||||
To enable Telegram notifications in your installation, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user