Get header data from webhook in automation template

Hi there! I’m a first responder, and I’m trying to set up a system that’ll allow me to view some info about my alerts.

My pager app has the functionality of sending a webhook when recieving an alert, and to set a custom header. I’m currently using the custom header to add a token to my webhooks, so I don’t fall out of bed at three in the morning because someone somewhere got ahold of my webhook ID.

The only issue presenting itself is the following: I still need to actually get the header data on the other end (read: Home Assistant) so I can do a check whether it’s a match. I’ve been trying to use an automation and a condition with a template to achieve this. Sadly, I’m at a loss as to how to actually get the value of the header.

I’d greatly appreciate any help! I’m sorry if this question has been asked before, but I just can’t seem to figure out how to do it.

Maybe you can use the HA API to set a state or something?

Update: Thanks to @Hellis81 for your suggestion! I’ve managed to find a workaround for my specific issue:

I’m using Webhook Relay to move my authentication away from Home Assistant. It’s free, and you can authenticate your incoming webhooks using a bearer token. That’s good enough for me.