Monitoring API with Node.js, Express, and Twilio
This project provides a Monitoring API built with Node.js and Express. It allows users to monitor certain events or data and receive notifications via SMS using Twilio.
The API provides endpoints for registering monitoring events, updating event status, and retrieving event data. When an event status is updated, the API automatically sends an SMS notification to the configured phone number using Twilio's SMS service.
- Register monitoring events: Users can register events by providing event details such as name, description, and target resource.
- Update event status: Events can be updated with a new status (e.g., "ongoing," "resolved") via API endpoints.
- Retrieve event data: Users can fetch event data, including event details and status, via API endpoints.
- SMS notifications: The API integrates with Twilio's SMS service to send notifications to a configured phone number whenever an event's status is updated.
Before running the project, make sure you have the following installed:
- Node.js (v14 or above)
- npm package manager
- Twilio account and phone number with SMS capabilities
- MongoDB (or any other supported database) for storing event data
- Clone the repository:
git clone https://github.com/your-username/monitoring-api.git
- Change to the project's directory:
cd monitoring-api
- Install the dependencies:
npm install
-
Configure environment variables:
- Rename the
.env.example
file to.env
. - Update the
.env
file with your Twilio credentials and database connection details.
- Rename the
-
Start the application:
npm start
The API will be accessible at http://localhost:3000
.
To use the Monitoring API, follow these steps:
-
Register an event by sending a POST request to the
/events
endpoint with the required event details. -
Update the event status by sending a PUT request to the
/events/:eventId
endpoint, providing the event ID and the new status. -
Retrieve event data by sending a GET request to the
/events/:eventId
endpoint, specifying the event ID. -
Receive SMS notifications for event status updates on the configured phone number.
Refer to the API documentation for detailed information on the available endpoints and request/response formats.
The API documentation can be found at http://localhost:3000/api-docs
once the application is running. It provides detailed information about the endpoints, request/response formats, and example usage.
This project is licensed under the MIT License.
If you have any questions or need further assistance, feel free to contact the project maintainer:
- Name: MD Mohaymen Ul Anam
- Email: [email protected]