AI Email Automation

My name is Emmanuel. I am a software engineer.

Have you ever wondered what it would be like to automate your email inbox or set up rules that dictate how emails land in your inbox? I am sure you love using Hashnode or LinkedIn but occasionally get emails that do not resonate with your interests. But seeing your love for Hashnode, you do not wish to add Hashnode to the spam list, right? If only there was a way to set rules that allow you to help Hashnode send you better emails without losing your sanity or blocking them altogether.

Well, worry not. Today, I present Inbox AI, an AI agent that works for you. It allows you to define rules or automations dictating how an email should work for you. You can set rules instructing it to forward all cold emails to your assistant or all transaction receipts to your private email. This way, you ensure you do not lose a thing. It can even archive an email based on your rules.

Tools

This program is powered by Gemini AI, offering you impressive computational speed and function calling. With the aid of Vercel SDK for a uniform and intuitive AI application development and Inngest to help process or retry your tasks in the background asynchronously, this leads to better performance and system resilience.

Disclaimer

This application is currently in development and is not recommended for production unless you are very knowledgeable.

Inspiration

I started out this programming journey not knowing where it would take me. I have signed up for a lot of good and useless emails. I love reading articles from Hashnode, but the issue is most times they would send articles that do not resonate with my interests. I do not wish to unsubscribe; I just wanted to be able to make some rules for my inbox. With that problem in mind, I decided to create this application for this very hackathon. Obviously, I had been keeping it at the back of my mind for a while, but now is a good time to showcase it and let people suffering from a similar problem receive relief.

Dependencies

The program was built with some of the popular dependencies and tools.

  1. Next.js 14

  2. Vercel AI SDK

  3. Gemini API

  4. Inngest (background jobs)

  5. Supabase (Database)

  6. Zoho (easy webhook integration, Gmail coming soon)

Environment Variables

Copy the following to get started with the project.

INNGEST_DEV=1
INNGEST_API_KEY=""

NEXT_PUBLIC_URL="" # preferably a public link, use ngrok

# https://api-console.zoho.com
NEXT_PUBLIC_ZOHO_CLIENT_ID=""
NEXT_PUBLIC_ZOHO_OAUTH_SCOPE="ZohoMail.messages.ALL,ZohoMail.accounts.ALL"
NEXT_PUBLIC_ZOHO_REDIRECT_URL=""
ZOHO_CLIENT_SECRET=""

# Supabase credentials
NEXT_PUBLIC_SUPABASE_URL=""
NEXT_PUBLIC_SUPABASE_ANON_KEY=""

# Gemini API
# https://ai.google.dev/
GOOGLE_GENERATIVE_AI_API_KEY=""
  1. You would need to create a client on Zoho in order to integrate this application to be eligible for the OAuth flow. You can follow the documentation; they explained it in detail OAuth 2.0 User Guide | Zoho Mail API.

  2. Get a public link from ngrok, which will be used to send the OAuth code during redirect.

Project

The code for this project can be found here on my GitHub account.

Conclusion

It is a fairly simple but very useful tool in the real world because I am tired of deleting emails that keep coming. Let's be DRY for once as developers.