Skip to content

Commit 68a6187

Browse files
azogueballoob
authored andcommitted
Telegram Bot doc changes for pull request home-assistant#7294: Telegram Bot enhancements with callback queries and more notification options (home-assistant#2508)
Telegram Bot doc changes for pull request home-assistant#7294: some required fixes and an example of an AppDaemon app. Telegram Bot doc changes for pull request home-assistant#7294: fix Telegram Bot doc changes for pull request home-assistant#7294: minimal clarification about disabling notifications for Telegram web users Telegram Bot doc changes for pull request home-assistant#7294: added new notification services (like in the `mediaplayer` component doc); added a description to how operates now the `notify.telegram` platform; changed service calls from `notify/telegram_bot` to `telegram_bot/EXPLICIT_NEW_SERVICE` in some of the yaml examples and in the appdaemon example. Telegram Bot doc changes for pull request home-assistant#7294: added `parse_mode` global config variable in webhooks and polling platforms; fixed links to /components/notify.telegram Telegram Bot doc changes for pull request home-assistant#7294: removed complex usage of telegram_bot services (moved to the telegram_bot doc); removed api_key from required params; removed multiple target feature (it can be done with the telegram_bot services or simply defining more than one notifier); added keyboard and inline_keyboard config vars to every type of notification. Telegram Bot doc changes for pull request home-assistant#7294: change 'hass' to 'Home Assistant'
1 parent f90d929 commit 68a6187

File tree

4 files changed

+368
-15
lines changed

4 files changed

+368
-15
lines changed

source/_components/notify.telegram.markdown

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ The `telegram` platform uses [Telegram](https://web.telegram.org) to delivery no
1818
The requirements are:
1919

2020
- You need a [Telegram bot](https://core.telegram.org/bots). Please follow those [instructions](https://core.telegram.org/bots#6-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.
21-
- The `chat_id` of an user.
21+
- You need to configure a [Telegram bot in Home Assistant](/components/telegram_bot) and define there your API key and the allowed chat ids to interact with.
22+
- The `chat_id` of an allowed user.
2223

2324
To retrieve your `chat_id`, contact any of the Telegram bots created for this purpose (@myidbot, @get_id_bot)
2425

@@ -45,22 +46,51 @@ $ python3
4546
To enable Telegram notifications in your installation, add the following to your `configuration.yaml` file:
4647

4748
```yaml
48-
# Example configuration.yaml entry
49+
# Example configuration.yaml entry for the Telegram Bot
50+
telegram_bot:
51+
platform: webhooks
52+
api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
53+
allowed_chat_ids:
54+
- CHAT_ID_1
55+
- CHAT_ID_2
56+
- CHAT_ID_3
57+
58+
# Example configuration.yaml entry for the notifier
4959
notify:
5060
- name: NOTIFIER_NAME
5161
platform: telegram
52-
api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
53-
chat_id: YOUR_CHAT_ID
62+
chat_id: CHAT_ID_2
5463
```
5564
5665
Configuration variables:
5766
5867
- **name** (*Optional*): Setting the optional parameter `name` allows multiple notifiers to be created. The default value is `notify`. The notifier will bind to the service `notify.NOTIFIER_NAME`.
59-
- **api_key** (*Required*): The API token of your bot.
6068
- **chat_id** (*Required*): The chat ID of your user.
6169

6270
To use notifications, please see the [getting started with automation page](/getting-started/automation/).
6371

72+
### {% linkable_title Text message %}
73+
74+
```yaml
75+
...
76+
action:
77+
service: notify.NOTIFIER_NAME
78+
data:
79+
title: '*Send a message*'
80+
message: 'That's an example that _sends_ a *formatted* message with a custom keyboard.'
81+
data:
82+
keyboard:
83+
- '/command1, /command2'
84+
- '/command3, /command4'
85+
```
86+
87+
Configuration variables:
88+
89+
- **message** (*Required*): Message text.
90+
- **title** (*Optional*): Will be composed as '%title\n%message'.
91+
- **keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom keyboard.
92+
- **inline_keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with asociated callback data.
93+
6494
### {% linkable_title Photo support %}
6595

6696
```yaml
@@ -81,10 +111,15 @@ action:
81111
caption: I.e. for a Title
82112
```
83113

114+
Configuration variables:
115+
84116
- **url** or **file** (*Required*): For local or remote path to an image.
85117
- **caption** (*Optional*): The title of the image.
86118
- **username** (*Optional*): Username for a URL which require HTTP basic authentication.
87119
- **password** (*Optional*): Username for a URL which require HTTP basic authentication.
120+
- **keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom keyboard.
121+
- **inline_keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with asociated callback data.
122+
88123

89124
### {% linkable_title Document support %}
90125

@@ -99,13 +134,16 @@ action:
99134
document:
100135
file: /tmp/whatever.odf
101136
caption: Document Title xy
102-
103137
```
104138

139+
Configuration variables:
140+
105141
- **url** or **file** (*Required*): For local or remote path to a document.
106142
- **caption** (*Optional*): The title of the document.
107143
- **username** (*Optional*): Username for a URL which require HTTP basic authentication.
108144
- **password** (*Optional*): Username for a URL which require HTTP basic authentication.
145+
- **keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom keyboard.
146+
- **inline_keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with asociated callback data.
109147

110148
### {% linkable_title Location support %}
111149

@@ -123,7 +161,10 @@ action:
123161
longitude: 117.22743
124162
```
125163

164+
Configuration variables:
165+
126166
- **location** (*Required*): For local or remote path to an image.
127167
- **latitude** (*Required*): The latitude to send.
128168
- **longitude** (*Required*): The longitude to send.
129-
169+
- **keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom keyboard.
170+
- **inline_keyboard** (*Optional*): List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with asociated callback data.

0 commit comments

Comments
 (0)