The Automated Gmail Replier is a Node.js application that automates the process of responding to unreplied emails during a specified period, such as a vacation. It leverages the Gmail API to interact with your Gmail account and perform actions like sending automated replies and labeling emails related to your vacation.
- Features
- Getting Started
- Prerequisites
- Installation
- Obtaining Credentials
- Configuration
- Usage
- Automatically sends a predefined vacation response to emails that haven't been replied to.
- Labels incoming emails during your vacation period for better organization.
- Periodically checks for unreplied emails and responds accordingly.
- Node.js installed on your machine. You can download it here.
- Gmail API credentials:
- Follow the instructions in Obtaining credentials.json file section to create a project, enable the Gmail API, and obtain the
credentials.json
file.
- Clone the repository:
git clone https://github.com/gauravjalap/Automated-Gmail-Replier.git
- Go to the App Folder.
cd Automated-Gmail-Replier
- Open the CodeBase in your IDE.
code .
- Install the node_modules.
npm install
- Run the App.
node index.js
The application will start on http://localhost:5000.
To use the Gmail API, you need to set up API credentials. Follow these steps:
-
Go to the Google Cloud Console.
-
Create a new project by clicking on the "Select a project" dropdown in the top bar, then click on "New Project."
-
Select the newly created project by clicking on "Select a project" again.
-
In the Cloud Console, navigate to the API & Services Dashboard by searching for "API & Services" in the top search bar.
-
Click on "Enable APIs and Services."
-
In the search bar, type "Gmail API" and select it.
-
Click the "Enable" button to enable the Gmail API for your project.
-
Go to the "OAuth consent screen" by clicking on it in the sidebar.
-
Choose the "External" user type for now and fill out the required information in the OAuth consent screen form. Click "Save and Continue" to proceed to the next step.
-
Add the required scopes by clicking on "Add or Remove Scopes" in the "Scopes" section. Add the following scopes: https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/gmail.send
-
Click "Save and Continue."
-
Add test user emails that you want to manage or send automated replies to using this application. Click "Save and Continue."
-
Go to the "Credentials" section in the sidebar.
-
In the "OAuth 2.0 Client IDs" section, find the entry related to your application. Click on the download icon to download the JSON file containing your credentials.
-
Rename the downloaded JSON file to
credentials.json
. -
Place the
credentials.json
file in the root directory of the automated Gmail responder application.
- Modify the
labelName
variable in theindex.js
file to set the name of the label for vacation-related emails. - Adjust the vacation response message in the
sendReply
function. - The interval for checking emails is set randomly between 45 to 120 seconds. You can modify this interval in the
setInterval
function.
- Access the application by visiting http://localhost:5000 in your browser.
- The application will authenticate with your Gmail account using the credentials in
credentials.json
. - Once authenticated, it will create a label for vacation-related emails (if not already exists) and periodically check for unreplied emails, sending automated responses and applying the vacation label. ‣畁潴慭整ⵤ浇楡敒汰敩ੲ