Automation Service Call using template?

Hi

I have an automation that sends notifications to different service (iOS App, Telegram etc) based on the home alarm state changing. We recently added a ring keypad and now predominantly use this for every day use.

This has caused me to want to modify the automation to only notify the other person of the alarm state change and not the person actually using the keypad.

I initially came up with this for testing, in dev tools it appears to render correctly:

notify.telegram_{% if (is_state_attr('alarm_control_panel.house', 'changed_by', 'Ross')) %}ross
{% elif (is_state_attr('alarm_control_panel.house', 'changed_by', 'EJ')) %}ej
{% else %}notify_both {% endif %}
Result type: string
notify.telegram_ej

So I tried this:

service: >-
  notify.telegram_{% if (is_state_attr('alarm_control_panel.house',
  'changed_by', 'Ross')) %}ej {% elif
  (is_state_attr('alarm_control_panel.house', 'changed_by', 'EJ')) %}ross {%
  else %}notify_both {% endif %}

But get the following error:

extra keys not allowed @ data['parse_mode']

So my question, is what I am trying to do simply not an option here or have I formated something incorrectly?

I can think of several other methods to achieve the same outcome with “choose”, or “if, else” etc but just interested to know why this does not work as I expected it to.

Thanks for the input in advance.