Created by the author free images and ai.

Inbox Zen: Master Your Emails with a Go-Powered AI Butler

Slaying Inbox Chaos, One Label at a Time

David Minkovski
6 min readSep 14, 2023

--

Motivation

Okay, here it goes: Every morning I wake up to an inbox of a gazillion newsletter mails — and don’t get me wrong…I signed up to them volunterally. However I feel like there is so much information and spam in these mails that it’s easy to be overwhelmed.
I just want to know the gist of any news and please give me the discounts or whatever it is you are trying to gift me. YES, I am being lazy and pragmatic.
So being the engineer at heart I think I can solve this using some good old Golang, Google Mail API and some AI? (because why not #buzzword)

Step 1: What am I trying to build here?

Simply said — If I had a clone of me at home, what should he do instead of me? I find this approach quite easy if I want to narrow the steps down.
1. Get my emails
2. Check for Newsletters
3. Get a summary of this newsletter and save it somewhere
4. Find discounts or gifts in there and save those too
5. Mark this email as read, so it’s not in my inbox anymore
6. Once per week — send me an email with a summary of all those newsletters — or earlier if the discount is valid for one day or so.

Translation into tech world because my brain is already wired that way:
I will need a program that runs automatically everyday (at least every hour). I am choosing Golang because it’s a fun language and it’s insanely fast. The Google Mail API will hopefully allow me to get my Emails and figure out a way to “mark” them. And then I will need some AI service to sum up the contents. I think I am going to go for Azure Open AI…because Microsoft rocks. Also funny enough — this is all assumptions. At any step in this project I might find out that I can’t do it because of some limits. But it’s worth a try, right?

Aaaaand it became a hackathon project at our company

Lucky for me, I work with some exceptional talent who has agreed to help me in making my idea reality as part of a hackathon week.
The cool thing?
We are all skilled in different spaces. One of us is a Golang Guru and she is an amazing Software Engineer. One is a project management pro and has every certification you ever heard of. One is a heavy experienced consultant and has a great eye for customer success.
And then there is me. I will find something to do to. Probably I will add ridiculous & funny memes to our group chat for some motivation.

Step 2: Write some basic user stories…

We need some basics to know what we are building and to not loose track of the MVP (minimum viable product) approach. So what is it we are doing?
User Stories:

  1. As a user, I want to be able to login / connect using my Google Mail and have access to the program.
  2. As a user, I want the product to automatically retrieve my emails every day, so I don’t have to manually check them.
  3. As a user, I want the product to scan for newsletters in my inbox and separate them from other emails and mark them as read.
  4. As a user, I want the product to generate a concise summary of each newsletter and save it in a designated location for future reference.
  5. As a user, I want the product to identify any discounts or gifts mentioned in the newsletters and store them for my review later.
  6. As a user, I want to see a user interface of the compiled weekly newsletters containing summarized content from all the newsletters (within a week), providing me with a convenient overview.
  7. As a user, I want to see the discounts and gifts seperataly in the UI so I can utilize them immediatly.

Or, you can always ask ChatGPT…not that I would ever do that. Pssssht.

Hackathon Spirit

One of the most important aspects of a hackathon is that we have no rules but rather want to explore things. Get our ideas to work. Use different technologies, make mistakes, learn something new and collaborate. But most importantly — have fun!!! The best spirit to work on a project like this.

Step 3: Initialize a Github Repo where we can collaborate

Starting a coding project without git is not permitted nowadays. Because otherwise — it would become a mess. Please just do it.
So let’s go ahead and create one:

dminkovski/project-zen: Master Your Emails with a Go-Powered AI Butler (github.com)

Then we split the tasks:

  1. Build a python microservice with django to target Azure OpenAI and summarize the emails as well as extract discount codes
  2. Build a golang microservice with gin that authenticates with the Google Mail API and get those nasty emails / newsletters
  3. Build a react frontend using vite to display a basic home page and the newsletter summaries

Aaaaaaand let’s make this work. Somehow.

Our beautiful landing page

Our golang Service uses the Google Mail API and thus we created a dedicated mail account.
Up & Running on the fabulous App Service. Check it out. For Real.
Our top notch SE was done within a couple hours. Yes, because she can.

The python service was up and running within this week and works, again using App Service (microsoft.com).

And the Frontend…let’s not talk UI or UX — but it does request the emails from the Go service and then iterates for the AI summaries on the python side. Why? Because we can and we wanted to explore those technologies and because we did not have too much time.

Let’s add a nice AI generated image & logo, some pages and we’re good:

Result page with fetched and summarized NL emails

TLDR & Key Learnings:

Overall we had a lot of fun collaborating and working together on this little project during our hackathon. Our prototype uses a google mail, reads the mails and summarizes them using AI.
I think there is still quite some potential to make this work for everyone’s private emails and to add some more features like:

  • Extracting the discounts
  • Adding a custom LLM
  • Add images
  • Updating UI / UX
  • Clean code and write tests…JK not going to happen, ever.

and more…when we have time. IF we have time. *Coffee required*

Our Key Learnings:

  • Go is great to spin up services quickly — Duuuh.
  • Microsoft App Service is perfect to deploy an application blazingly fast.
  • Azure OpenAI is amazing. Perfect to applying artifical intelligence.
  • AI is not just implemented by accessing some API. You really need to think about the right use cases and most importantly PROMPTS.
    We iterated those a couple of times.
  • AI is not a fancy thing to throw at problems. It’s a tool, just like everything else. You need to know when and how to use it.
  • Summaries that are longer than the email itself are not optimal.
    Which leads us to:
  • Sending an api call to Azure OpenAI is cool .. sending an api call to Azure OpenAI is even way cooler when you know how to structure your prompt, which opens another realm of learning on its own.
    — Shoutout to Karim Wahby.
  • We might think we know how to do something, we actually don’t!
    We come to discover that the hard way, when we are in the process of actually implementing it, this is when the fun starts and you start solidfying your learning and troubleshoot your way through a successful deployment.
    — Shoutout to Karim Wahby.
  • A team that has different levels of experience including a “newbie”, is not a bad thing .. everyone gets to learn something and see how the others are doing it and learn from them as well.
    — Shoutout to Karim Wahby.
Project Zen

After a week we have Version 0.00000000001 available.
You can find this version of our hackathon project here:

Project-Zen

DISCLAIMER:
To everyone — It will not work. Probably.
We are not open for feedback, yet.
Just kidding. Are we??!

--

--