Skip to content

Latest commit

 

History

History
29 lines (27 loc) · 3.04 KB

README.md

File metadata and controls

29 lines (27 loc) · 3.04 KB

📩 Gmail Notifier

Gmail Notifier is a python application script that monitors your Gmail Inbox using the Gmail API for any new emails. The user recieves a desktop notification each time there is a new email sent.

Here is a snapshot of what the notification might look like! altText

📌 Set up

  1. Use the Use this template commpand to create a repository with the source code.
  2. Create a virtual environement env from the command python3 -m venv env in the folder where you want to create the project.
  3. Clone the source code in the into your project folder.
  4. Install the following python libraries
    • pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
  5. Enable the Gmail API and create the ncessary credentials.
    • Go to the Google Developor Console and create a new project. Include the Project ID in the PROJECT_ID environment variable in the .env file.
    • Enable the Gmail API for the project through the API Console for the project.
    • From the Credentials tab in the API Console, create a OAuth 2.0 Client ID and a Service Account
    • Select the Edit Oauth Client ID button in the OAuth Client ID actions and select Download JSON. Rename this file to credentials.json and upload it to the utils folder in your project root. Ensure that the location for the credentials is consistent in the .env file.
    • Using the Edit action for the service account, create a key by navigating to the Keys tab and selecting the approporate options. Download the key as a .Json file. Rename the file to serviceCredentials.json and upload it to the utils folder at project root.
  6. Enable the Google Pub/Sub messaging service. The python program uses Google Pub/Sub as a messaging tool.
    • Create a Pub/Sub Topic using the Create Topic tab within the same project created in the previous step.
    • To create a Pub/Sub scubscription navigate to the Topics tab and select the topic created in the previous step.
    • Navigate the Subscriptions tab and select Create Subscription. Select the approporate options neccesary.
    • Add the service account created prior as a Pub/Sub Subscriber using the Add Principal section in the Permissions tab.
  7. cd into the folder where the main.py file is located. Use the:memo: command in the terminal to start the script.

📝 TODO

  1. Include support for scheduling. Create a configuration file which records the _HistoryID neccesary to poll the Pub/Sub client.
  2. Provide Support for programmatically replying to emails.

License

This project is licensed under the Mozilla Public License 2.0