Last updated January 22, 2023.
Airbnb has blown up, especially in NYC, where I live. Because of this, people are using smart locks more. They’re convenient, and cool, since you can give guests access to your house from anywhere, and then revoke it when they leave.
There are two problems with using a smart lock for your apartment, though — it’s hard to get permission from your landlord to alter your lock, and when guests use it, they have to download an app and request access, which is complicated and confusing.
Enter my solution: all they have to do is go to a webpage and tap a button, and voila — they're in.
At first flush, that sounds pretty risky. But my webpage is hidden and password-protected, so it's been never been an issue.
To control my apartment's intercom/door buzzer from anywhere, I use SwitchBot. Its sole purpose is to press buttons, so naturally it was a good fit for the intercom — all I had to do was stick it right next to the "Door" button, and it took care of the rest.
As you can see above, all it takes is opening the app and pressing a button to unlock your apartment building from anywhere.
After setting this all up, though, I wasn't satisfied — I wanted to make the unlocking process as simple as possible. If you do what I did — use SwitchBot to buzz people in, and Sesame to unlock your door — that's two apps that guests would have to use, which is asking a lot.
Luckily, I created a way for guests to unlock your home, just by accessing a webpage, and entering a password. See below for the code I used, which you can reproduce on your own site.
See the Pen Smart lock dashboard by Aaron (@ayeag) on CodePen.
Before I give instructions for creating the webpage, I wanted to mention that both Sesame and SwitchBot don’t require any internal alterations to your door and intercom — they both mount on top, so your landlord probably won’t notice, or care.
The most important part is line 4 of the JavaScript:
xhttp.open("GET", "https://maker.ifttt.com/trigger/[insert-trigger-name-here]/with/key/[insert-key-value-here]",true);
The URL in this line is what makes the magic happen. I'll break it down for you — here’s the first portion:
“https://maker.ifttt.com/…”
This is the call to the API, where all the data is stored. You can learn more about how the API works in the developers section of the site.
The next portion is the “trigger”:
“…/trigger/[insert-trigger-name-here]/…”
The trigger is the "event" that sets the applet in motion. With webhooks, the trigger is always a request from another website. So when I press the "Buzz me in" button from my website, that’s the trigger.
When you create a webhooks applet, you have to give the event a name, like "buzz_me_in". So if that's what you decide on, this portion of the URL would read:
“…/trigger/buzz_me_in/…”
The last part is called the “key”:
“…/with/key/[insert-key-value-here]…”
The key is like your Social Security number — it’s a bunch of numbers (and letters) unique to you, that should be kept private.
To find your key, go to the “webhooks” page on IFTTT and connect your account. Then click on “Settings” in the upper-right corner. On the next screen, you should see a URL that looks like this:
“https://maker.ifttt.com/use/[insert-key-value-here]”
Copy the key value at the end and paste it into line 4 of the JavaScript. Here it is again, if you need it:
xhttp.open("GET", "https://maker.ifttt.com/trigger/[insert-trigger-name-here]/with/key/[insert-key-value-here]",true);
That's all it takes to run an IFTTT applet on a webpage, and give access to your apartment to anyone with a browser.
Replicate these steps for the other triggers — unlocking your apartment door, locking the door, etc. — by using the code above, and feel free to email me with any questions.