-
Notifications
You must be signed in to change notification settings - Fork 0
Notification Service is a Node.js REST API for sending notifications via Email, SMS, and In-App channels. Built with Express and MongoDB, it integrates with Twilio and SMTP (Gmail) for reliable messaging. Easily fetch, filter, and mark notifications through a clean, modular API β ready for integration into any app.
License
DEVanshDEVS/notification-service
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Β | Β | |||
Β | Β | |||
Β | Β | |||
Β | Β | |||
Β | Β | |||
Β | Β | |||
Β | Β | |||
Repository files navigation
π¬ Notification Service A Node.js REST API to send notifications via Email, SMS, and In-App channels. Built with Express, MongoDB, Twilio, and SMTP (Gmail). π Features β Send notifications via: Email SMS In-App π₯ Fetch notifications for a user (with optional filtering by type) β Mark In-App notifications as read π RESTful API with clean, modular code ποΈ Persistent storage using MongoDB ## πΌοΈ Screenshots >β οΈ **If the images below do not display properly, please check the `screenshots` folder in this repository to view sample screenshots directly.** π **Email Notification Sample**  π **Sending Email Notification via Postman**  π **Fetching All Notifications via Postman**  π **In-App Notification via Postman**  π Easily integrable with any frontend or backend π οΈ Setup & Installation 1. Clone the repository bash: git clone https://github.com/DEVanshDEVS/notification-service.git cd notification-service 2. Install dependencies bash: npm install 3. Configure environment variables Create a .env file in the root directory: PORT=3000 MONGODB_URI=mongodb://localhost:27017/notification_service # Email (Gmail SMTP example) SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your_email@gmail.com SMTP_PASS=your_gmail_app_password # Twilio TWILIO_ACCOUNT_SID=your_twilio_sid TWILIO_AUTH_TOKEN=your_twilio_auth_token TWILIO_PHONE_NUMBER=your_twilio_number 4. Start the server bash: npm start The server will run at: π http://localhost:3000 π API Endpoints β€ Send a Notification POST /notifications json: { "userId": "USER_ID_HERE", "type": "in-app", // or "email" or "sms" "message": "This is a test notification!" } β€ Get All Notifications for a User GET /notifications/users/:id/notifications Optional Filter by Type: ruby: /notifications/users/:id/notifications?type=in-app β€ Mark In-App Notification as Read PATCH /notifications/:notificationId/read π€ User Management Ensure user documents exist in MongoDB. Notifications are sent to these users. Sample User Document json: { "name": "Receiver", "email": "receiver@example.com", "phone": "+1234567890" } π§ͺ Example Requests β Send In-App Notification bash: curl -X POST http://localhost:3000/notifications \ -H "Content-Type: application/json" \ -d '{"userId":"USER_ID_HERE","type":"in-app","message":"Hello from in-app!"}' π₯ Get All In-App Notifications bash: curl http://localhost:3000/notifications/users/USER_ID_HERE/notifications?type=in-app β Mark Notification as Read bash: curl -X PATCH http://localhost:3000/notifications/NOTIFICATION_ID/read π Notes β Never commit your .env file to a public repository. π§ Gmail SMTP requires an App Password (not your login password). π± Twilio requires an active account and a verified sender number. π License This project is licensed under the MIT License. See the LICENSE file for more details. π Contributing Found a bug? Have a feature request? Open an issue or submit a pull request! Happy Notifying! ποΈ
About
Notification Service is a Node.js REST API for sending notifications via Email, SMS, and In-App channels. Built with Express and MongoDB, it integrates with Twilio and SMTP (Gmail) for reliable messaging. Easily fetch, filter, and mark notifications through a clean, modular API β ready for integration into any app.
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published