Is it possible to create custom responses for webhooks?

Hello all,

I’m trying to solve the following scenario:

  • Send a request to HA
  • Do something on said request (this is can be accomplished with webhooks)
  • Return a CUSTOM response (the state of a sensor following the automation for example)
  • Do something with said response in my other device

From what I gathered from the docs and countless hours of searching, it is not possible to create a custom reponse for webhooks to pass an arbitrary payload back to the caller.

Thanks!

2 Likes

Not an expert but trying to do something similar, I found this useful

The custom response could be built with the REST Command that is called as part of the automation triggered by the webhook.
HTH

Thanks for answering.

I’ve already stumbled uppon that post, but sadly I fail to see how it can help me.

The last step of the automation can indeed be a REST command, but that means a new request from HA to my other device, not a custom response.

I do think it’s impossible, which is sad.

I think I get you now…Just to confirm, you want the http response to the websocket request to contain some custom info in the body , ie more than a 200 ok in the header?

I have no idea how to do that, sorry.

That is exactly what I want, for example:

  • Request: GET /webhooks/{id}
  • Response: 200 OK with data {“whateverIwant”: “whateverValue”}

Hey did you somehow manage to do that in the meantime?

Did anyone of you guys mange to find a solution to this?

I want to do this:

  • Request: GET /webhooks/{id}
  • Response: 200 OK with data {“whateverIwant”: “whateverValue”}

It is possible to do a custom response for a webhook with Google Apps Script for example. But i cant find a way to do this in Home Assistant or Node Red in Home Assistant…

I need to do the same thing. I have a service that post’s a validation token (a string) to the webhook that needs to be sent back in an HTTP 200 response within 10 seconds. I was hoping this was something I could use with Nabu Casa, but I see no way to process the incoming JSON payload and then responding with my own JSON.

Has anyone found a way?

Hello iam also looking for this

I am also looking for this

Hey, sounds like a pretty basic feature for HA to have… I’m surprised it’s missing.

+1 for this feature.

Would like this as well

Yeah, seems that the easiest solution right now is through NodeRed.

I am also wanting to do this. I want to expose an webhook URL that will just response true or false but I also can not find any way to do it with node red and the webhook node.

I spoke/wrote too early, I needed to use the HTTP IN node and make requests to http://homeassistant:1880/endpoint/my-end-point-here