I have created a webhook automation that tries to read the request header information that is triggered from a Flic button initiated Internet Request that it’s supposed to be able to include the GPS data from the mobile phone into the request header of the internet request that the webhook will process.
However, I’m not able to see any header information trigger.headers in my automation.
Have anyone successfully retrieved request header information in an automation? I want to at least narrow down whether it’s a Home Assistant issue or a Flic app issue. Thanks.
Hello h2GLcRo4lmlC,
A webhook in it’s basic config is nothing more than a button. If you want to pass data as well you have to know what data is sent and receive the data on the other end.
If my camera sees someone at one of my properties HA sends this
sequence:
- action: shell_command.person_detected
data: { "message": "{{message}}" }
And the shell_command is
person_detected: curl -X POST -H 'Content-type:application/json' --data '{"message":"I spy a {{message}} person"}' https://hooks.nabu.casa/gAAAAABjBredacted=
And this receives it on the other HA instance firing off a tts… Home-Assistant-Config/automation2/Presence_A2.yaml at 870129406841f3b6275f174f5eeb7e8a716be3ce · SirGoodenough/Home-Assistant-Config · GitHub
Well, the data (or the JSON body) got passed into the webhook with no problem. The issue was the request header, those got stripped out going into Home Assistant.
Anyway, I made a workaround solution with Cloudflare Worker that reads the request header and then format it into the JSON body instead and have the webhook read the request header information from the JSON body (that was packaged by the Worker) directly.