Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vikas350/mailbot

This is a Gmail Auto-Reply Bot application
https://github.com/vikas350/mailbot

express google-api googlecloud nodejs

Last synced: about 7 hours ago
JSON representation

This is a Gmail Auto-Reply Bot application

Awesome Lists containing this project

README

        

# MailBot - Auto Reply Gmail Bot using Node.js

## Description
- This app is able to respond to emails sent to your Gmail mailbox while you’re out on a vacation. This is developed uisng Node.js and Google Authentication.

## Features
- Checks for new emails in a given Gmail ID.
- Sends replies to emails that have no prior replies.
- Adds a label to the email and moves the email to the label.
- This app checks above steps every 45 to 120 in b/w sec random time interval.

## Libraries
- googleapis: This package is imported from the googleapis module and provides the necessary functionality to interact with various Google APIs, including the Gmail API.
- OAuth2:The OAuth2 class from the google.auth module is used to authenticate the application and obtain an access token for making requests to the Gmail API. It handles token refresh and retrying requests if necessary.

## Getting Started
To start the project follow these steps -

1. Download the Source Code Zip file From the Github
2. Unzip the file and open in any IDE
3. Now run these commands in the Terminal -
```bash
# Install NPM dependencies
npm install

#Install googleapis and nodemon
npm install googleapis nodemon
```
4. Now we need to generate the Google OAuth Credentials, For that follow these steps -
- Go to the Google Cloud Console (https://console.developers.google.com) and create a new project. Provide a suitable name for your project and click on the "Create" button.
- Once the project is created, click on the project name to navigate to the project dashboard.
- In the left sidebar, click on the "Credentials" tab under the "APIs & Services" section.
- Before further steps, you have to provide the OAuth Consent under the "OAuth Consent Screen" section.
- Now select the application type as "Web application" and provide a name for the OAuth 2.0 client ID.
- In the "Authorized redirect URIs" field, enter the redirect URI where you want to receive the authorization code.
- Click on the "Create" button to create the OAuth client ID. You will see a modal displaying the client ID and client secret.
- Now Download the Credentials JSON file from here and put into our code as "Credentials.json".
- Now at the end Create a test User for our application in the "APIs & Services" section.
- Also enable the Gmail API from the "Library" section.

5. Now run this command in terminal
```bash
# Simply start your app
npm start
```
6. Now open browser and type url (http://localhost:8080), and enter this will open a new tab for login.
7. Login with the test user email which you created earlier.
8. All Steps Done.