Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 74 additions & 1 deletion source/_integrations/telegram_bot.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ Send a notification.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_photo`

Send a photo.
Expand All @@ -221,6 +223,8 @@ Send a photo.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_video`

Send a video.
Expand All @@ -246,6 +250,8 @@ Send a video.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_animation`

Send an animation.
Expand All @@ -272,6 +278,8 @@ Send an animation.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_voice`

Send a voice message.
Expand All @@ -297,6 +305,8 @@ Send a voice message.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_sticker`

Send a sticker.
Expand All @@ -322,6 +332,8 @@ Send a sticker.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_document`

Send a document.
Expand All @@ -348,6 +360,8 @@ Send a document.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_location`

Send a location.
Expand All @@ -367,6 +381,8 @@ Send a location.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_poll`

Send a poll.
Expand All @@ -385,6 +401,8 @@ Send a poll.
| `reply_to_message_id` | yes | Mark the message as a reply to a previous message. In `telegram_callback` handling, for example, you can use {% raw %}`{{ trigger.event.data.message.message_id }}`{% endraw %} |
| `message_thread_id` | yes | Send the message to a specific topic or thread.|

This action returns a [send message response](#send-message-response).

### Action `telegram_bot.send_chat_action`

Send a chat action. Use it to notify the user with the relevant "typing" action when a bot response may be delayed, so they know a message is coming soon. Telegram clears this status after 5 seconds or when the reply arrives.
Expand Down Expand Up @@ -498,6 +516,40 @@ Sets the bot's reaction for a given message.
| `reaction` | no | Emoji to react to the message with. |
| `is_big` | yes | Whether to use a large variant of the reaction animation. |

## Response schemas for actions

{% tip %}

Responses can be accessed using the `response_variable` of actions.
You can refer to the [send a message then edit it after a delay](#example-send_message-then-edit-it-after-a-delay) automation for an example of usage of the response.

{% endtip %}

### Send message response

Response schema:

| Data attribute | Optional | Type | Description |
| -------------- | -------- | -------------------- | ------------------------------------------------------------------------- |
| `chats` | no | list | A list of chat objects. Each object represents a successful message sent. |

Chat object schema:

| Data attribute | Optional | Type | Description |
| ---------------| -------- | ------- | --------------------------------------- |
| `chat_id` | no | integer | The target chat_id of the sent message. |
| `message_id` | no | integer | The id of the message. |

Example response:

```yaml
chats:
- chat_id: 1234567890
message_id: 100
- chat_id: -1234567890
message_id: 200
```

## Telegram notification platform

{% warning %}
Expand Down Expand Up @@ -999,6 +1051,27 @@ actions:
disable_web_page_preview: true
```

## Example: send_message then edit it after a delay

{% raw %}

```yaml
actions:
- action: telegram_bot.send_message
data:
message: testing
response_variable: response
- delay:
seconds: 5
- action: telegram_bot.edit_message
data:
message: done testing
chat_id: "{{ response.chats[0].chat_id }}"
message_id: "{{ response.chats[0].message_id }}"
```

{% endraw %}

## Example: send_message to a topic within a group

```yaml
Expand All @@ -1016,7 +1089,7 @@ actions:

```yaml
alias: telegram send message and delete
sequence:
actions:
- action: telegram_bot.send_message
data:
message: testing
Expand Down