/outbox-backend

a node.js server that read and replies to your unread emails

Primary LanguageJavaScript

Email Automation with AI

Introduction

This project aims to automate email processing and replies using Google's Generative AI and Gmail APIs. By leveraging AI, the system can understand the context of received emails and assign automatic labels. It then generates appropriate replies based on the content of the emails one at a time.

Prerequisites

Before running the application, make sure you have the following:

  • Node.js installed on your machine
  • Google Cloud Platform project with the Gmail API enabled
  • Google API credentials in JSON format
  • A valid API key for Google's Generative AI

Installation

  1. Clone the repository:
  2. git clone <repository_url>
  3. Install dependencies:
  4. npm install
  5. Set up environment variables:
  6. Create a .env file in the project root directory and add the following:

    GEMINI_API_KEY=<your_google_api_key>

    Replace <your_google_api_key> with your actual Google API key.

Usage

To start the server, run:

npm start

Endpoints

  • /login: Redirects to Google login consent screen for OAuth2 authentication.
  • /auth/google/callback: Handles Google's redirect after user login.
  • /emails: Fetches emails, processes them using AI, and sends automated replies.

Contributing

Contributions are welcome! Please read the contributing guidelines before getting started.

License

This project is licensed under the MIT License.