Create temporary webhooks to allow guests to open the entrance once

Hi,

I was wondering if anyone has any suggestions how I could create temporary webhooks, or anything similar to that.
I have automated my entrance door, and I’d like to be able to share in the most simplistic way possible a temporary link/webhook that would allow a guest to open my door just once!
Things to take into consideration here:

  1. I don’t want to create a home assistant profile for the guest nor share my own credentials
  2. I would prefer if downloading an app on the guest’s phone is not necessary
  3. I would like to ensure that I’m not compromising on the security of my home assistant installation by sharing such link with a complete stranger
  4. It’d be great if I could create a card in home assistant, where I’d just have to press a button, and a link appears for me, ready to share for 1 time use.
  5. After use, the token/link should become invalid and not usable anymore

Pro to have but not necessary: would be to generate the token/url for a pre-set period like 1 full day or 1 week.

Looking forward to hear if anyone has any ideas on how to achieve this.

Cheers!

To do this directly in HomeAssistant you would have to expose your API interface to the world, which is obviously not ideal, meaning that once they had the URL for your “one-time code” they have the root URL for your system.

If I were trying to do this I would put a “man in the middle”, you could perhaps do this with Zapier, where you hard code in the base URL plus a variable “code” into the Zap and then the person you want to give access to is accessing Zapier instead of you directly.

Because I’m a developer, I would personally just write an quick PHP script on one of my servers that they make the call to with my URL in the code, which is not world readable, and enforce the one-time use or time limited use policy there in a database, then they call MY URL with some code on it. And you could easily enhance it to generate codes for you as well so you could click a button and either have the script send an email with the code or populate a variable in HA with the code it generated.

Or, alternatively, get a smart lock where you can set and revoke access codes via HA scripts, then they just key in the 4-8 digit code for entry. I do this when I go out in my RV and need to have a friend do something at the house when I’m gone, I have a pre-set code that I disable after the first use.