When you type that URL into a browser, you’re performing a GET request. Webhooks are expecting a POST, accompanied by some data. You’ll need to test with a utility like Postman or curl.
I don’t know how it ever would have worked from a browser.
I’ll also mention here that your webhooks should be something that is not easily guessable. I typically use two GUIDs concatenated; it ends up looking like this:
I know this is probably just a test automation, but if this actually opened or unlocked a door, it could be a real problem if it were guessed. Treat your webhook IDs like passwords because they kind of are.
Right you are. I was mistaken that it previously worked in HASS.
And thanks for pointing out about the security. I’m using this with IFTTT, but I’m not using their API which has a similarly long key. I’m thinking why bother with the IFTTT integration when I can create my own long “key” for each webcommand.
Hi, since this is one of the top posts regarding home assistant and webhooks: Am I the only one who is not able to find official documentation about webhooks? Do I need to activate that somehow? By default there is not even port 80 or 443 opened, if I am right. Also my port scanner does not find anything there. Or is it configured automatically when I use platform: webhook?
In IFTTT, set THAT to Webhook - Make a web request. URL is your webhook in HASS. Method is Post. Content Type is text/plain. Everything else blank (default).
You can also download the Postman program to test your webhooks.
That’s because when you visit that URL through a browser, it’s a GET request, but in Postman, you can specify it to be a POST (which it has to be in order to work). It would be useful if HomeAssistant had web hooks that worked via GET, but currently, it does not.
Hi,
I recently was searching for a way to trigger webhooks externally to HASS.
I found out that you can create an automation with a webhook ID.
Afterwards in settings->cloud, when you activate the webhook, it gives you something like https://hooks.nabu.casa/random_id with what you can trigger this webhook also “externally” through the NabuCasa cloud, if you have it actived.
Is there any way to grab saved webhook values from database or history?
I have system in place that I forward the alarm state via webhook. It works and it even saves the history somehow, but every time I restart the HA the value is unknown. How could I get there latest value automatically before the state is next time changed?
I haven’t tried this, but I am going to when I get a chance: Use a trigger-based template sensor to store the webhook info. Unlike other template sensors, trigger-based template sensors retain their states through HA restarts.
And since the docs say you can use any of the triggers that are available to automations, that then includes webhook triggers.
So, create a trigger-based template sensor using your webhook as the trigger.
Then all your other actions/automations in HA can be based off state changes to that template sensor.
Edit: here’s a simple example. This webhook will just toggle a binary sensor every time the webhook is hit.