From 98b0fa058ce57cfdb97c3b623d192b57925513b0 Mon Sep 17 00:00:00 2001 From: Nikolai Date: Sun, 8 Nov 2020 15:54:35 +0300 Subject: [PATCH] Feature telegram_sent (#14853) --- source/_integrations/telegram_bot.markdown | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/source/_integrations/telegram_bot.markdown b/source/_integrations/telegram_bot.markdown index 0015661cf42..8192c6d8357 100644 --- a/source/_integrations/telegram_bot.markdown +++ b/source/_integrations/telegram_bot.markdown @@ -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 %}