mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-22 16:56:50 +00:00
Add Telegram Bot response message ID (#35904)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
b9083c3b74
commit
8c5511c506
@ -20,6 +20,8 @@ If you don't need to receive messages, you can use the [broadcast](/integrations
|
||||
|
||||
Available actions: `send_message`, `send_photo`, `send_video`, `send_animation`, `send_voice`, `send_sticker`, `send_document`, `send_location`, `edit_message`, `edit_caption`, `edit_replymarkup`, `answer_callback_query`, `delete_message` and `leave_chat`.
|
||||
|
||||
Actions that send contents (`send_*`) will return a list of `message_id`/`chat_id` for messages delivered (in a property called `chats`). This will populate [Response Data](/docs/scripts/perform-actions#use-templates-to-handle-response-data) that you can further utilize in your automations to edit/delete the message later based on the `message_id`. See the example later on this page for usage instructions.
|
||||
|
||||
### Action `telegram_bot.send_message`
|
||||
|
||||
Send a notification.
|
||||
@ -608,3 +610,27 @@ actions:
|
||||
parse_mode: html
|
||||
disable_web_page_preview: true
|
||||
```
|
||||
|
||||
## Example: automation to send a message and delete after a delay
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
alias: telegram send message and delete
|
||||
sequence:
|
||||
- action: telegram_bot.send_message
|
||||
data:
|
||||
message: testing
|
||||
response_variable: response
|
||||
- delay:
|
||||
seconds: 5
|
||||
- repeat:
|
||||
sequence:
|
||||
- action: telegram_bot.delete_message
|
||||
data:
|
||||
message_id: "{{ repeat.item.message_id }}"
|
||||
chat_id: "{{ repeat.item.chat_id }}"
|
||||
for_each: "{{ response.chats }}"
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user