How can i use a template selector field in a script?

How can i use a template selector field in a script?

When i pass a template value as a field in a script, it just passes it as a string without evaluating the template,
And i couldn’t find any way to render this template and evaluate it inside the script.

Does anyone have any solution for this issue?

For reference, this is my script:

sequence:
    - action: notify.mobile_app_idan_phone
      data:
        message: "{{message}}"
        title: "{{title}}"
alias: "[Alerts] Notifications Sender Handler"
description: ""
fields:
  message:
    selector:
      template: {}
    required: true
  title:
    selector:
      template: {}

Please repost using the </> Preformatted Text option.

You also have a typo here:

message: “{(message}}”

You need a { not a (.

Thanks for the replay, i added it as pre-formatted text.

It was actually { and not ( in my original script,
I was just editted out some unnecessary parts of the script to reduce to noise and wrote ( when i edit the post by mistake.

For example, if i pass {{1+2}} in the template field,
It would just send a notification message of “{{1+2}}” instead of evaluating the template and sending “3”.

Are you putting quotes around your template? Like this?:

fields:
  message:
    selector:
      template: "{{ 2 + 1 }}"
    required: true

There shouldn’t be a value for template like that in the field definition.

I swapped in a persistent notifcation instead of a mobile notification for testing, but it seems to be working for me when called from the Action tool:

sequence:
  - action: notify.mobile_app_idan_phone
    data:
      message: "{{message}}"
      title: "{{title}}"
alias: zTest [Alerts] Notifications Sender Handler
description: ""
fields:
  message:
    selector:
      template: null
    required: true
  title:
    selector:
      template: null

Shocking discovery!
It seems to wiork perfectly fine when runnig the script as action from developer tools,
But it’s not working when you run it with the exact same inputs from the script “more info” dialog, and that’s where i was testing my script.

Seems like a defect.

Thanks @Didgeridrew for testing the script on your env!
And thanks as well to everyone else who tried to help.