How to template an action in my automations?

I am going round in circles here. I’ve read the (sparse) documentation, and my googling is sending me around the same few results each time.

I am playing around with automations. I have an end goal in mind, but en-route, I’ve quickly discovered that the automations UI doesn’t support what I’d like to do. It appears I need to use templating (somehow)

Here is my automation pseudocode

alias:  TEST1
trigger:
  - platform: time_pattern
    minutes: "*"
action:
  - service: input_number.set_value
    data: 
      value: {{ 22 }}
      entity_id: input_number.my_number

Somebody will absolutely miss the point of the {{ 22 }}, so please read the next bit carefully.
The aim is not to get the value 22 into my input_number. The final logic isn’t written yet, but I think should be acheivable with a template. {{ 22 }} is just a test to prove/disprove that I can use a template.

I can’t find any documentation which clearly shows me what is possible in an action.
I can find references to the deprecated data_template, I’ve seen value_template seemingly used randomly. Without docs I have no idea how to add some form of templated logic to my action’s value.

Somebody please point me in the right direction.

      value: "{{ 22 }}"

You’re missing quotes. Alternatively you can use yamls multiline string syntax and omit the quotes like this:

      value: >-
        {{ 22 }}

If you put a template in a field then you have to either wrap it in quotes or use the multiline syntax. You can’t leave it open like that or it will get parsed incorrectly since brackets have other meaning in yaml.

Have you read this yet?

If not I suggest doing so. Lot of info on templating and examples.

Start here: Templating

Where you can/cannot use a template is often indicated in the documentation for the option you want to template, either explicitly (stated in its description) or implicitly (presence/absence of an example containing a template).

Here’s an example from the documentation for Input Number showing how to template the value option (note use of quotation marks, as mentioned by CentralCommand). The example serves to implicitly indicate the value option accepts a template.

  - alias: "Set temp slider"
    trigger:
      platform: mqtt
      topic: "setTemperature"
    action:
      service: input_number.set_value
      target:
        entity_id: input_number.target_temp
      data:
        value: "{{ trigger.payload }}"

In addition to the information provided by @CentralCommand and @123, make sure tocheck out the docs page specifically about Service Calls… there are multiple examples using templates.

Thank you all.
Whilst I had read all the pages mentioned, I hadn’t digested them. I should have kept revisiting them. The more you learn, the more nuggets of useful you get out of stuff you’ve already read, The templates page is well written as far as it goes, and gives great info on what templates can do, but I struggled with “where can I use them”. I surprised myself on getting so close. I was half expecting “oh no, you can’t do it that way”.
Once again, thank you.