From 73c27b33891b3fe472f97c1cd417c59687df40da Mon Sep 17 00:00:00 2001 From: Nikolai Melkov Date: Sun, 4 Oct 2020 00:27:01 +0300 Subject: [PATCH 1/4] New feature telegram_sent --- 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 85811b11b075..c2a44de90f92 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"]]]` | +| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | ### 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"]]]` | +| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | ### 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"]]]` | +| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | ### 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"]]]` | +| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | ### 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"]]]` | +| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | ### 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` with 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: + result_code: 123 + 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 %} \ No newline at end of file From 3881bc868dc9602c8037e3101a2c5f5952400bb0 Mon Sep 17 00:00:00 2001 From: Nikolai Melkov Date: Sun, 4 Oct 2020 18:57:39 +0300 Subject: [PATCH 2/4] rename telegram_bot attibute --- source/_integrations/telegram_bot.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/_integrations/telegram_bot.markdown b/source/_integrations/telegram_bot.markdown index c2a44de90f92..64be8827e37c 100644 --- a/source/_integrations/telegram_bot.markdown +++ b/source/_integrations/telegram_bot.markdown @@ -32,7 +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"]]]` | -| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | +| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | ### Service `telegram_bot.send_photo` and `telegram_bot.send_sticker` @@ -52,7 +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"]]]` | -| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | +| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | ### Service `telegram_bot.send_video` @@ -72,7 +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"]]]` | -| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | +| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | ### Service `telegram_bot.send_document` @@ -92,7 +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"]]]` | -| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | +| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | ### Service `telegram_bot.send_location` @@ -106,7 +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"]]]` | -| `result_code` | yes | The response result code of the sent message. In `telegram_sent` event data: `{{trigger.event.data.result_code}}` | +| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | ### Service `telegram_bot.edit_message` @@ -440,7 +440,7 @@ Receiving `chat_id` and `message_id` identifiers of sent messages by the `telegr platform: event event_type: telegram_sent event_data: - result_code: 123 + internal_request_id: 123 action: - service: input_number.set_value data_template: From 22db3f2869ad0ae60b151e58c459d4ab4853dea2 Mon Sep 17 00:00:00 2001 From: Nikolai Melkov Date: Sun, 18 Oct 2020 22:55:03 +0300 Subject: [PATCH 3/4] rename telegram_bot attibute --- source/_integrations/telegram_bot.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/_integrations/telegram_bot.markdown b/source/_integrations/telegram_bot.markdown index 64be8827e37c..4d166aa7da55 100644 --- a/source/_integrations/telegram_bot.markdown +++ b/source/_integrations/telegram_bot.markdown @@ -32,7 +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"]]]` | -| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | +| `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` @@ -52,7 +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"]]]` | -| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | +| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` | ### Service `telegram_bot.send_video` @@ -72,7 +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"]]]` | -| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | +| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` | ### Service `telegram_bot.send_document` @@ -92,7 +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"]]]` | -| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | +| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` | ### Service `telegram_bot.send_location` @@ -106,7 +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"]]]` | -| `internal_request_id` | yes | Internal ID of requests to send messages. In `telegram_sent` event data: `{{trigger.event.data.internal_request_id}}` | +| `message_tag` | yes | Tag for sent message. In `telegram_sent` event data: `{{trigger.event.data.message_tag}}` | ### Service `telegram_bot.edit_message` @@ -440,7 +440,7 @@ Receiving `chat_id` and `message_id` identifiers of sent messages by the `telegr platform: event event_type: telegram_sent event_data: - internal_request_id: 123 + message_tag: "msg_start" action: - service: input_number.set_value data_template: From 3a1ea9658b6092b04f1d564114f0894e94316d59 Mon Sep 17 00:00:00 2001 From: Nikolai Date: Sat, 31 Oct 2020 21:31:45 +0300 Subject: [PATCH 4/4] Update telegram_bot.markdown --- source/_integrations/telegram_bot.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/_integrations/telegram_bot.markdown b/source/_integrations/telegram_bot.markdown index d5f665480151..8192c6d83576 100644 --- a/source/_integrations/telegram_bot.markdown +++ b/source/_integrations/telegram_bot.markdown @@ -450,4 +450,6 @@ Receiving `chat_id` and `message_id` identifiers of sent messages by the `telegr data_template: entity_id: input_number.message_id value: '{{ trigger.event.data.message_id }}' -``` \ No newline at end of file +``` + +{% endraw %}