Giter Club home page Giter Club logo

notification-service's Introduction


Twilio Sendgrid

Node.js Version TypeScript Version Test Coverage

Notification Service

The Notification Service is an application developed in Node.js with the aim of providing a solution for sending notifications via email and SMS. It uses the SendGrid platforms to send emails and Twilio to send SMS messages. The project was built on technologies: Express, TypeScript and MongoDB.

Functionalities

notification-service
├── LICENSE
├── README.md
├── jest.config.js
├── package-lock.json
├── package.json
├── src
│   ├── config
│   │   ├── logger.ts
│   │   └── mongoose.ts
│   ├── controller
│   │   ├── email.controller.ts
│   │   └── sms.controller.ts
│   ├── interfaces
│   │   ├── email.interface.ts
│   │   └── sms.interface.ts
│   ├── middlewares
│   │   └── morganMiddleware.ts
│   ├── models
│   │   ├── email.model.ts
│   │   └── sms.model.ts
│   ├── repositories
│   │   ├── email.repository.spec.ts
│   │   ├── email.repository.ts
│   │   └── sms.repository.ts
│   ├── routes
│   │   ├── email.routes.ts
│   │   ├── main.routes.ts
│   │   └── sms.routes.ts
│   ├── services
│   │   ├── email
│   │   │   ├── send.email.service.spec.ts
│   │   │   ├── send.email.service.ts
│   │   │   ├── update.email.service.spec.ts
│   │   │   └── update.email.service.ts
│   │   └── sms
│   │       └── send.sms.service.ts
│   └── validations
│       ├── email.validator.schema.ts
│       └── sms.validator.schema.ts
└── tsconfig.json

System Requirements

Before running the project, make sure you have the following tools installed:

  • Node.js
  • MongoDB

Installation

  1. Clone the repository to your local environment:
git clone [email protected]:lucas-eedu/notification-service.git
  1. Navigate to the project directory:
cd notification-service
  1. Install project dependencies using npm:
npm install
  1. Configure the environment variables: Copy the .env.example file to .env in the project root and set the following variables:
APP_PORT=3000
APP_URL=http://localhost
APP_STAGE="development"

MONGODB_URI=MongoDBDatabaseURL

SENDGRID_API_KEY=SuaChaveAPIdoSendGrid

TWILIO_SID=YourSendGridAPIKey
TWILIO_AUTH_TOKEN=YourTwilioAuthenticationToken
TWILIO_PHONE=YourPhoneNumberTwilio

Replace the above values with your MongoDB authentication and configuration data.

  1. Start the server:
npm start

The server will be available at http://localhost:3000.

Tests

npm test

Unit tests for email and SMS services, as well as integration tests for controllers.

Contributors

Contributions are welcome! If you encounter any issues, have an idea for a new feature, or want to improve existing code, feel free to open an issue or submit a PR request. Let's build this project together and make it even better!

Contacts

Linkedin: https://www.linkedin.com/in/lucas-eduardo/
E-mail: [email protected]

notification-service's People

Contributors

lucas-eedu avatar

Watchers

 avatar

notification-service's Issues

Update Documentation and Add Example JSON File for Requests

Context:

After completing the implementation of the new webhook endpoint for updating the SMS sending status from Twilio, it's important to keep the project documentation up to date to reflect the changes made and facilitate understanding and usage of the service by developers.

Goal:

The goal of this task is to update the project's README file, including information about the new webhook endpoint, existing routes, expected parameters, their requirements, and to add an example JSON file exported from Insomnia to facilitate testing of requests.

Task:

  • Update the project's README with information about the new webhook endpoint, including its purpose, the corresponding route, expected parameters, their requirements, and usage examples.
  • Add existing routes to the README, detailing expected parameters, their requirements, and usage examples.
  • Create an example JSON file exported from Insomnia containing requests for each service route, including example input data.
  • Include instructions in the README on how to import and use the example JSON file in Insomnia to test requests.

Acceptance Criteria:

  • The README has been updated with information about the new webhook endpoint and existing routes, including details about expected parameters, their requirements, and usage examples.
  • An example JSON file exported from Insomnia has been added containing requests for each service route, with example input data.
  • The README contains clear instructions on how to import and use the example JSON file in Insomnia to test requests.

Creating endpoint to update SMS sending status

Context:

Currently, the notification service is already operational for sending SMS via Twilio. However, the functionality of receiving SMS delivery notifications from Twilio and updating the status of these deliveries in the database is missing.

Goal:

The goal of this task is to create a new webhook endpoint to receive SMS delivery notifications from Twilio and use these notifications to update SMS sending records in the database, changing their status from "pending" to the corresponding delivery status.

Task:

  • - Create a new webhook endpoint to receive SMS delivery notifications from Twilio.
  • - Implement the necessary logic to extract relevant data from the received Twilio delivery notification, including the unique identifier of the SMS sending.
  • - Query the database to find the corresponding record based on the received Twilio identifier.
  • - Update the status of the SMS sending in the database based on the data received from Twilio.

Acceptance:

  • - Follow the project's pattern with controller, service, and repository.
  • - Unit test.

Install and Configure Swagger for API Documentation

Context:

To enhance the documentation process and provide a more interactive and user-friendly experience for developers, it's essential to integrate Swagger into the project. Swagger will allow us to generate comprehensive API documentation automatically, ensuring that developers have easy access to all endpoints, parameters, and response schemas.

Objective:

The goal of this task is to install and configure Swagger for API documentation generation and to create comprehensive documentation for the API endpoints, including descriptions, parameters, request/response examples, and error codes.

Task:

  • Install and set up Swagger in the project environment, ensuring compatibility with the existing Node.js and Express framework.
  • Configure Swagger to automatically generate documentation based on the API routes and controllers.
  • Document all API endpoints in Swagger, including:
    • Descriptions of each endpoint's purpose and functionality.
    • List of parameters with their types, descriptions, and whether they are required or optional.
    • Request body schema and examples (if applicable).
    • Response schema and examples, including success and error responses.
  • Ensure that the Swagger documentation is kept up to date with any changes or additions to the API endpoints.

Acceptance:

  • Swagger is successfully installed and configured in the project environment.
  • API documentation is generated automatically by Swagger, covering all endpoints and providing comprehensive information about each.
  • Each API endpoint is documented with clear descriptions, parameter details, request/response examples, and error codes.
  • The Swagger documentation is accessible and user-friendly, allowing developers to easily understand and interact with the API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.