Skip to content

PritomKarmokar/SenderAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SenderAPI

Developing a RESTAPI using FastAPI that will send an email when someone registers themselves

Installation

Clone the repository

git clone [email protected]:PritomKarmokar/SenderAPI.git
cd SenderAPI

Run Locally with venv

Ensure you have Python and pip installed on your machine.

  1. Create a virtual environment:
    python -m venv venv
  2. Activate the virtual environment:
    • On Windows:
      venv\Scripts\activate
    • On Unix or macOS:
      source venv/bin/activate
  3. Install dependencies:
    pip install -r requirements.txt
  4. Run the FastAPI app:
    uvicorn code.main:app --reload

Run with Docker using docker-compose

Ensure you have Docker and docker-compose installed on your machine.

  1. Build and run the Docker containers:
    docker compose up --build

Usage

Access the app at http://localhost:8000

API Documentation

Access API documentation:

Configuration

Gamil API Client Secret

  1. Create a Google Cloud project

  2. Enable the API

  3. Configure the OAuth consent screen

    • set the User type to External
  4. Authorize credentials for a desktop application

  5. Finally store the 'credentials.json' in code/api_credentials directory

Sending Email Notification

When a user registers through the API, a welcome email will be sent using the Gmail API. The endpoint for registration is:

  • POST /register: This endpoint takes the user's firstname, lastname (optional) and email address and saves it to the database, then sends a welcome email using Gmail API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published