Feature telegram_sent (#14853)

This commit is contained in:
Nikolai 2020-11-08 15:54:35 +03:00 committed by GitHub
parent 19503368e8
commit 98b0fa058c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@ Send a notification.
| `disable_web_page_preview`| yes | True/false for disable link previews for links in the message. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. `[]` to reset to no custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` |
### Service `telegram_bot.send_photo` and `telegram_bot.send_sticker`
@ -51,6 +52,7 @@ Send a photo.
| `timeout` | yes | Timeout for send photo. Will help with timeout errors (poor internet connection, etc) |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. `[]` to reset to no custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` |
### Service `telegram_bot.send_video`
@ -70,6 +72,7 @@ Send a video.
| `timeout` | yes | Timeout for send video. Will help with timeout errors (poor internet connection, etc) |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. `[]` to reset to no custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` |
### Service `telegram_bot.send_document`
@ -89,6 +92,7 @@ Send a document.
| `timeout` | yes | Timeout for send document. Will help with timeout errors (poor internet connection, etc) |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. `[]` to reset to no custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` |
### Service `telegram_bot.send_location`
@ -102,6 +106,7 @@ Send a location.
| `disable_notification` | yes | True/false for send the message silently. iOS users and web users will not receive a notification, Android users will receive a notification with no sound. Defaults to False. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. `[]` to reset to no custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` |
### Service `telegram_bot.edit_message`
@ -424,3 +429,27 @@ Telegram callbacks also support arguments and commands the same way as normal me
{% endraw %}
In this case, having a callback with `/repeat 1 2 3` will pop a notification saying `I repeat: [1, 2, 3]`
Receiving `chat_id` and `message_id` identifiers of sent messages by the `telegram_bot`.
{% raw %}
```yaml
- alias: 'Notifications about messages sent by Telegram bot'
trigger:
platform: event
event_type: telegram_sent
event_data:
message_tag: "msg_start"
action:
- service: input_number.set_value
data_template:
entity_id: input_number.chat_id
value: '{{ trigger.event.data.chat_id }}'
- service: input_number.set_value
data_template:
entity_id: input_number.message_id
value: '{{ trigger.event.data.message_id }}'
```
{% endraw %}