Call script from RESTfull notification to turn on speakers before tts

Scince two days I am trying to figure out how to use RESTfull notification to call a home assistant script. Unfortunately there is not much information to be found for RESTfull Notifications.

I got a RESTfull command working like this:

    url: http://ha-ip:8123/api/services/script/turn_on
    method: POST
      authorization: !secret ha_token_rest
      content-type: 'application/json'
    payload: '{"entity_id":"script.tts_on_stereo", "variables":{"message":"one more test"}}'

But any try to do the following notify variant fails with message:

Source: /usr/src/homeassistant/homeassistant/components/rest/
Integration: RESTful (documentation, issues)
First occurred: 00:22:25 (2 occurrences)
Last logged: 09:44:30

Client error. Response 400: Bad Request:
NoneType: None

I tried a lot of differnent combinations under data, but allways got the same error.

  - name: notify_by_script
      platform: rest
      resource: http://ha-ip:8123/api/services/script/turn_on
      method: POST_JSON
        authorization: !secret ha_token_rest
        content-type: application/json
         what comes here? just setting the payload entries from command above did not work.

I need the script notification so i can first turn on the speakers, then call the tts service. I need to use a notify platform so it is compatible with e.g. Alert integration.

Can anyone please give me a hint, how to get this work? I have read any nearly related topic and could not find the answer, so any help would be greatly appriciated!

I finally figured this out. I was not aware that it is also possible to call the script directly as service. So this is my solution:

- name:  notify_by_script
    platform: rest
    resource: http://ha-ip:8123/api/services/script/tts_on_stereo
    method: POST_JSON
      authorization: !secret ha_token_rest
      content-type: application/json
    message_param_name: message

So message_param_name: message does take the message parameter passed to notify and passes it as message to my script, that can use it as variable.

I must say, that the restfull notification could use some more documentation and examples. Same for the HA rest api.

What helped me a lot, was first using curl commands from a terminal to see what works and not along with the log in HA.