HA with Node-red and Rhasspy: /api/intent/handle documentation

Rhasspy is able to use the /api/intent/handle endpoint to send intents to HA. After looking through the Rhasspy logs I found that HA responds with json that includes text that I would like to use to send a voice notification through speakers in my home.

I’ve learned that Rhasspy sends this text response to it’s TTS system, but it’s audio out system does not work exactly how I need it to for sending audio to my speaker system. So I am exploring making the request to the /api/intent/handle endpoint manually using Node-Red. However, I can not find documentation that explains what needs to be passed in the body of the http request. Is anyone familiar with this endpoint and can share what needs to be sent in the request?

I don’t know much about Python but Looking through the intent code, it looks like the name key is required to be sent in the request and data is optional.

What needs to be passed in the data key?

I also checked out Rhasspy’s code for calling the endpoint and see the data object being built up before making the request but I’m having trouble making out how the slot is being configured to be passed to HA. https://github.com/rhasspy/rhasspy-homeassistant-hermes/blob/f6990128dab5a3828f7c89653e9d8d719af517ba/rhasspyhomeassistant_hermes/init.py

I realize this is a HA issue but since Rhasspy can successfully make a request to this endpoint ,I’m hoping someone that worked on this integration could share what they are adding to the data key.

To give a bit more context I started out following the documentation to integrate Rhasspy with HA outlined here, Usage - Rhasspy.

After some digging, I didn’t find official documentation but there is a Pull Request in HA github from a few years ago that has the correct json that needs to be passed to the /api/intent/handle endpoint. This is PR is for the /api/conversation/handle but I think it was meant to be used together with the intent endpoint (and it works :slight_smile: ).

For anyone else looking to use this endpoint, the correct request body for the intent endpoint is below:

{ "name": "HassTurnOn", "data": { "name": "Kitchen light" } }

The response should be 200 with the following JSON message

"{"speech": {"plain": {"speech": "Turned Lounge Lamp on", "extra_data": null}}, "card": {}}"

Now I am wondering what else can be passed as a part of the object within the data key.

@synesthesiam I see that you had a hand in this on both the HA and Rhasspy sides. Do you have any documentation or info that you can share that can shed more light on what other keys can be passed in the data object?