About this blueprint
Wait for a telegram_text
event and execute an action. Can be filtred by user_id
and chat_id
.
Technical Details
- Type of blueprint: SCRIPT
Configuration
Requirements
- Telegram Bot integration
Blueprint fields
-
Remove received message?: Activate this toggle to delete the received message from chat. Useful for private or secret messages (alarm codes, passwordsâŚ).
-
Sequence if message is received: What should happen when receiving the text message.
-
Sequence if message is NOT received: What should happen when NOT receiving any message.
Script variables
These variables can be set up when calling the script. See Passing variables to scripts for more information.
-
timeout
: Maximum time to wait for receiving a message, in seconds. Default 30 seconds. -
filter_user_id
: Execute the sequence ONLY IF the text message is received from this user_id. Leave empty to avoid filtering. -
filter_chat_id
: Execute the sequence ONLY IF the text message is received from this chat_id. Leave empty to avoid filtering.
Available variables for templating
Event data received from telegram are parsed as variables so that they are easily used in templates. These variables can be used within this automation:
-
telegram_text
: Text message. -
telegram_sender_first_name
: Senderâs first name. -
telegram_sender_last_name
: Senderâs last name. -
telegram_sender_full_name
: Senderâs full name, asfirst_name + " " + last_name
-
telegram_sender_user_id
: Senderâs user id. -
telegram_chat_id
: Chat id.
Template example
Use format {{ variable_name }}
in order to print a variable, as usual in Home Assistant.
Example: Hi {{ telegram_sender_first_name }}! You said: {{ telegram_text }}.
Related blueprints
-
Telegram Bot: Conversation with Assist (and others like OpenAI)
-
Telegram Bot: Store a text message into an input_text entity
-
Telegram Bot: Respond to Telegram Command with a text message
-
Telegram Bot: Respond to Telegram Command by executing an action
Other blueprints
How to get this blueprint?
Click the badge to import this Blueprint:
Or you can also:
- Copy-paste the content from this link to a new file inside your configurationâs
blueprints/automation
folder.
Changelog
- 2022-01-30: Solved issue when not receiving any message.
- 2022-01-30: New option to remove received message.
- 2022-01-30: First release.