Trigger templated automation from RestAPI

Hi everyone,

This is maybe a very simple question as it seems to me I’m missing something.

I’d like to trigger an automation from a restAPI call and give a custom value to be used in the template.

Let’s say my automation is the one shown in the documentation but I want to customize the whole message like this:

# Example configuration.yaml entries
automation:
  trigger:
    platform: state
    entity_id: device_tracker.paulus
  action:
    service: notify.notify
    data_template:
      message: >
        {{ a_custom_text_sent_in_api_call }}

Is there a way I can set “a_custom_text_sent_in_api_call” in the request body’s json for instance?

I’ve tried this with no luck:

{
"a_custom_text_sent_in_api_call " : “Hello world from rest API!”
}

I’m not sure I follow what you want to do You should be able to send custom messages.
What I’m trying to understand is what is that custom message / where is it coming from and where is it stored…
you should be able to replace {{ a_custom_text_sent_in_api_call }} with something like {{ states.input_text.a_custom_text_sent_in_api_call.state }}

Thanks a lot,

Shouldn’t I define the state somewhere before?

I don’t have any input text:
“states.input_text.a_custom_text_sent_in_api_call”

This is mostly for learning purpose, I’m playing around with vocal commands from a google home device, calling hass web API with keyworks as parameter…

That’s the point, hence me asking ‘what is that custom message / where is it coming from and where is it stored’
If it’s a list of predefined messages, then you can store them in various input_text or even input_select (so they can be selected and triggered upon selection).
What exactly are you trying to do?