Skip to content

Commit be92f2c

Browse files
committed
Add more details
1 parent f97e423 commit be92f2c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/_components/notify.telegram.markdown

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The requirements are:
2020
- 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.
2121
- The `chat_id` of an user.
2222

23-
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).
23+
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) or to use `$ curl -X GET https://api.telegram.org/botYOUR_API_TOKEN/getUpdates`. Replace `YOUR_API_TOKEN` with your actual token.
2424

2525
The result set will include your chat ID as `id` in the `from` section:
2626

@@ -29,13 +29,14 @@ The result set will include your chat ID as `id` in the `from` section:
2929
"message":{"message_id":27,"from":{"id":123456789,"first_name":"YOUR_FIRST_NAME YOUR_NICK_NAME","last_name":"YOUR_LAST_NAME","username":"YOUR_NICK_NAME"},"chat":{"id":123456789,"first_name":"YOUR_FIRST_NAME YOUR_NICK_NAME","last_name":"YOUR_LAST_NAME","username":"YOUR_NICK_NAME","type":"private"},"date":1678292650,"text":"test"}}]}
3030
```
3131

32-
Another way to get your chat ID directly is described below:
32+
Another way to get your chat ID directly is described below. Start your Python interpreter from the command-line:
3333

3434
```python
35-
import telegram
36-
bot = telegram.Bot(token='YOUR_API_TOKEN')
37-
chat_id = bot.getUpdates()[-1].message.chat_id
38-
print(chat_id)
35+
$ python3
36+
>>> import telegram
37+
>>> bot = telegram.Bot(token='YOUR_API_TOKEN')
38+
>>> chat_id = bot.getUpdates()[-1].message.chat_id
39+
>>> print(chat_id)
3940
123456789
4041
```
4142

0 commit comments

Comments
 (0)