How do I activate script via IFTTT and pass value?

Trying to figure out how to pass value to Ha when using IFTTT web request ?

Passing the following in the body does not seem to work:
{"entity_id":"script.some_script","value1":"{{Text}}"}

Getting:

Invalid service data for script.turn_on: extra keys not allowed @ data[‘value1’]. Got ‘aaa’

Off the top of my head it would look like this…

{"entity_id":"script.some_script",
  "Data": {
      "value1":"{{Text}}"
    }
}

Obviously you can contract it back to one line, just expanded it to show you what I’m getting at for the structure.

Thanks for responding :slight_smile:

That resulted in the following error:

Invalid service data for script.turn_on: extra keys not allowed @ data[‘Data’]. Got {‘value1’: ‘qqq’}

I don’t know if it makes a difference but the D in data should be lowercase, that was a typo on my end.

Working on the same thing right now, as far as I understand you can call the script via the webhook directly “…/script/your_script?api…” so there is no need for the “entity_id” in the body. For passing a value, put

{"value1" : "{{TextField}}" }

in your body and then use “value1” simply as your varaible in your script. As far as I know that should work.

Using the following form did not work for me @ciB

https://xxx.duckdns.org/api/services/script/some_script?api_password=password

I believe the link should be:

https://xxx.duckdns.org/api/services/script/turn_on?api_password=password

and therefor entity_Id is required.


The following seems to work (variables instead of data),

{"entity_id":"script.some_script", "variables": { "value1":"{{Text}}" } }

Thanks @anon43302295 for putting me on the path :slight_smile:

1 Like

Glad you could solved it.
Got mine up and running just a sec ago too.
https://xxx.duckdns.org/api/services/script/some_script?api_password=password
at least worked for me (without the need of passing the entity_id then), don’t know why it wouldn’t work for you though.