How to make a webapp/server that can read & react to emails

In the last post, we talked about how to teach your Google Home device (or Google Assistant on your Android phone) to send emails.

But that itself is not too interesting (unless you really enjoy spamming yourself). What would be more useful is if you create a program to read and act on the emails automatically. Because, then, you have the ingredients for building your own Virtual Assistant.

The simplest (and cheapest way) I found to do this is using Google App Engine. It has a generous daily free quota. For all my home automation projects, I haven’t run above the free limit.

Start by following the “hello world” instructions to make your first web app:

Then, add the files/code below to enhance your web app to handle emails. (Note: the code I provided below is an example of how I use email to control my home sprinkler system. This lets me say “Turn on sprinkler 1” to my Google Home Mini, which triggers IFTTT to send an email to my web app, which reads the email and triggers my home sprinkler system to turn on zone 1.)


After you set up the above, you can send emails to your Google App Engine web app using its special address:

Now that you have a web app, there’s much more you can do beyond handling emails. It opens up a couple more opportunities for your home automation. E.g.:

  • Use this web app as a trusted HTTP server that your smart devices can fetch instructions from
  • Use this web app to serve a web GUI for your devices/projects
  • Use this web app (which supports HTTPS) to authenticate users and securely control your smart devices

Give it a go. I think the code I gave you above should work. If I missed something, please let me know at Happy hacking!