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 a name key is required to be sent in the request and data is optional.
core/homeassistant/components/intent at 939fde0a500f599fac9f9c5cd2befa8b75f45475 · home-assistant/core · GitHubinit.py

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. rhasspy-homeassistant-hermes/rhasspyhomeassistant_hermes at f6990128dab5a3828f7c89653e9d8d719af517ba · rhasspy/rhasspy-homeassistant-hermes · GitHubinit.py

I’m not familiar with endpoints so I can’t help there. If HA is sending info out, I believe that means an event is fired. If you listen for that event you can pull the response from there.

Thank you @Mikefila I do see a status changed event but that doesn’t have what I am looking for exactly.

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: ). Looks like the original implementation was added to the conversation handler and then was moved to the intent handler.

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.