The ReachInBox assignment aims to build a tool that parses and manages emails from Google and Outlook accounts, using AI to categorize and respond to emails based on their context. This server-based application is built with Node.js and Express, leveraging various APIs and AI services.
- Node.js
- Express.js
- OpenAI
- Google APIs
- Microsoft Graph API
- dotenv: For managing environment variables.
- axios: For making HTTP requests.
- bullMQ: For task scheduling and processing queues.
- google-auth-library: For integrating Google OAuth2.0.
- ioredis: Redis client for Node.js.
- @microsoft/microsoft-graph-client: Microsoft Graph API client library.
- @azure/msal-node: Microsoft Authentication Library (MSAL) for Node.js.
-
Clone the Repository:
git clone https://github.com/shraddha-gawde/reachInbox-assignment.git cd reachInbox-assignment/server
-
Install Dependencies:
npm install
-
Set Environment Variables: Create a
.env
file in the root directory with the following environment variables:PORT=*** GOOGLE_CLIENT_ID=*** GOOGLE_CLIENT_SECRET=*** GOOGLE_REDIRECT_URI=*** GOOGLE_REFRESH_TOKEN=*** OPENAI_API_KEY=*** redis_port=*** redis_host=*** redis_pass=*** AZURE_CLIENT_ID=*** AZURE_CLIENT_SECRET=*** AZURE_TENANT_ID=***
-
Run the Server:
npm start
-
Start the Worker:
npm run server
-
GET
/auth/google
: Google authentication. -
GET
/api/mail/userInfo/:email
: Retrieve user profile information. -
GET
/api/mail/allDrafts/:email
: Get all draft emails. -
GET
/api/mail/read/:email/message/:message
: Read a specific email by ID. -
GET
/api/mail/list/:email
: Get a list of emails. -
POST
/api/mail/sendMail
: Send an email with a specified label.{ "from": "sender@example.com", "to": "recipient@example.com", "label": "interested/not-interested/more-information" }
-
POST
/api/mail/sendone/:id
: Send a single email by ID.{ "from": "sender@example.com", "to": "recipient@example.com" }
-
POST
/api/mail/sendMultiple/:id
: Send an email to multiple recipients by ID.{ "from": "sender@example.com", "to": ["recipient1@example.com", "recipient2@example.com"] }
-
GET
/outlook/signin
: Microsoft Azure authentication for Outlook. -
GET
/outlook/callback
: Callback for obtaining access tokens. -
GET
/outlook/profile
: Get user profile data. -
GET
/outlook/all-Mails/:email
: Get all mails of a user. -
GET
/outlook/:email/read-Msg/:message
: Read a specific mail by message ID. -
POST
/outlook/:email/send-Mail
: Send an email using Outlook.{ "from": "sender@example.com", "to": "recipient@example.com", "label": "interested/not-interested/more-information" }
-
POST
/outlook/sendone/:email/:id
: Send a single email using Outlook with BullMQ.{ "from": "sender@example.com", "to": "recipient@example.com" }