if:
- condition: template
value_template: "{{ notificarTelegram is true }}"
then:
... Your ActionA ...
else:
... Your ActionB ...
The template will work only if notificarTelegram contains a boolean value. If it contains a string value then the template must be changed to {{ notificarTelegram == 'true' }}.
It would be helpful if you post your script in YAML format. It makes it easier for me, or others, to modify it so that it meets your requirements.