Hi,
I am trying to use information from the triggering event when handling telegram commands.
I can see that the templating works, as I can use the states variable when generating the response
{
"message": "Pong! {{ states.person.shaun_barlow.state }} "
}
But when I try to use the triggering event according to the documentation
{
"message": "Pong! {{ trigger.data.from_frist }} "
}
I get the error “Error while executing automation automation.telegram_pingpong. Error rendering template for call_service at pos 1: UndefinedError: ‘trigger’ is undefined”
Is the syntax for accessing the triggering event different for telegram_command events?
Extract from automations.yaml (as gnerated by editor) is
- id: '1570539050004'
alias: Telegram PingPong
trigger:
- event_data:
command: /ping
event_type: telegram_command
platform: event
condition: []
action:
- data:
message: 'Pong! {{ trigger.data.from_first }} '
service: notify.shaun_telegram
A sample event when subscribed from the HA UI is below (chat and user ID’s have been removed)
{
"event_type": "telegram_command",
"data": {
"user_id": xxxxxxx,
"from_first": "Shaun",
"from_last": "Last_name",
"chat_id": xxxxxxx,
"command": "/ping",
"args": []
},
"origin": "LOCAL",
"time_fired": "2019-10-08T14:14:21.387450+00:00",
"context": {
"id": "48c0298cf6564833b2bc1104bd33a643",
"parent_id": null,
"user_id": null
}
}
I have tried looking at other topics, but cannot seem to find a solution