Vacation Rental Automation with Google Scripts
In my previous posts I covered how to use Zapier to automate a large part of a vacation rental. This post details how I replaced Zapier with Google Scripts.
Zapier worked well enough, but there were lingering annoyances that I kept running into:
- Whenever I would edit a calendar event for a guest reservation, it would send an email to my cleaner. I didn't edit events often, but often enough that the extra emails got confusing.
- Once in awhile, VRBO would change their email format and the "magic" parsing that the Zapier email parser does would break in wonderfully mysterious ways. Suddenly, the guest name has newlines and the phone number is the check-in date. Not amusing.
- There was no way to extend the Zapier stuff or add more logic to things. If Zapier didn't do it, it couldn't be done.
I was already using Google Scripts (GS) for other projects, so converted from Zapier to GS. This also allows me WAY more leeway to do whatever I need and frees me of the five zap limit in Zapier. I use this chrome plugin to synchronize the code to the github repo.
What it does
- Parses incoming VRBO instant booking emails and processes them automatically
- Hosts a web form for manually adding new bookings and configuration
- Automatically puts reservations on your Google Calendar
- Automatically emails cleaners on new or changed reservations
- Will automatically send a text to guests (via Twilio) before they checkin
- Will automatically schedule lock codes before guests arrive
- Other minor niceties
Parsing E-Mails
vrbo_mail.gs handles emails from VRBO for new reservations. The function processVRBOEmails is configured as an hourly trigger to look at emails.
processCalendarEmails. calendar_mail.gs is configured as an hourly trigger. It handles the reminder emails that come before guests are set to checkin. I use these to trigger adding the lock code and sending the initial SMS welcome.
Web Interface
The web interface allows you to manually create reservations, using the same endpoint as the automated email parsing. I usually use this to create reservations for our own use, and for guests that book manually on our website, outside of VRBO.
I created a UI for managing the necessary configuration. In retrospect, I should have made it a separate Google Sheet to keep the code far more simple, but I didn't think of doing that at the time.
The UI is made with the Spectre CSS framework. This was my first project using Spectre, and I was very happy. I've been using Bulma a lot lately and playing with Tailwind, but I think Spectre will be my new goto framework. I ran into very few bugs, it has a lot of things included, and it's relatively small.
Cleaners
Once in awhile, I need to block some time, but not have the cleaners come clean. In these cases, I allow you to specify no cleaners. Likewise, the configuration allows configuring two different cleaners. I was planning to use this to trial two different services, but never ended up doing so.
Sending texts to guests
I expand on my previous post of using Twilio to communicate with guests. I used to send texts directly from Smart Things because it was easy. However, the texts would come from a short code, plus I assume they'll be phasing that capability out. So, in order streamline everything in one flexible number, I've continued moving to Twilio. You just configure your Twilio API credentials and it does the rest. It's still triggered from calendar notification events, covered under parsing emails above.
Scheduling lock codes
This works similar to how it did with Zapier. I call into a webhook to my code running in SmartThings. You can see this in external.js:schedule_lock.
Other Niceties
Using Twilio, Google Script, and Wave Apps have allowed me to do other things too:
- Guests can send text messages to control smart devices. They can lock the door, open the garage door, turn lights on and off, etc.
- Guests can directly book on my website. Checkout the code here.
- SmartThings reminds me when I visit the rental to enter a mileage expense. I can enter that expense by simply sending a text. Wave has a decent API, documented here and here.
- Send guests a custom short post-stay survey.
Maybe I'll detail how I did these in the future!