Notify is a robust notification service that allows you to send notifications to Firebase and OneSignal. This repository consists of two projects:
- Client Project: Built with Next.js.
- Server Project: Built with ASP.NET Core.
- Notification Providers: Supports Firebase and OneSignal for sending notifications.
- JWT Authentication: Ensures secure communication with the server.
- Swagger Integration: Provides API documentation for ease of use.
- Custom Methods: Includes reusable utility methods for various operations.
- Extensible Design: Easy to add more providers in the future.
- Controllers: Contains API controllers to handle incoming requests.
- Models: Contains application data models.
- Views: Used for rendering views if applicable.
Contains configuration files such as:
- JWT Configuration
- Swagger Configuration
Holds utility classes such as:
- Custom Methods
- JWT Authentication Classes
Contains models related to:
- DTOs (Data Transfer Objects)
- Entities
- Code for sending notifications.
- Supports sending notifications to Firebase or OneSignal.
Contains the Token Validation logic used to validate API tokens while sending messages.
- Sending a message does not require login.
- However, you must include the
ApiTokenin the request header for authentication.
To specify a provider, use the ProviderEnum:
public enum ProviderEnum
{
OneSignal,
Firebase
}This is the model used to structure the message:
public class MessageModel
{
public string? Receiver { get; set; }
public string? Title { get; set; }
public string? Content { get; set; }
}To send a single message, make a POST request to:
api/Messages/
Request Body:
{
"Receiver": "receiver_id",
"Title": "Notification Title",
"Content": "Notification Content"
}To send multiple messages, make a POST request to:
api/Messages/Multiple
Request Body:
[
{
"Receiver": "receiver1_id",
"Title": "Notification Title 1",
"Content": "Notification Content 1"
},
{
"Receiver": "receiver2_id",
"Title": "Notification Title 2",
"Content": "Notification Content 2"
}
]- Run the project and generate the
ApiTokenfrom the application.
- Node.js for the Next.js client.
- .NET SDK for the ASP.NET Core server.
- Firebase and/or OneSignal accounts for notification integration.
- Clone the repository:
git clone https://github.com/0Ankit0/Notify.git
- Navigate to the project directories and install dependencies:
- Client: Navigate to the
clientfolder and runnpm install. - Server: Navigate to the
serverfolder and restore NuGet packages.
- Client: Navigate to the
- Configure Firebase and OneSignal credentials in the server project.
- Start the server project using your preferred IDE or
dotnet run. - Start the client project using
npm run dev.
This project is licensed under the MIT License.
Contributions are welcome! Please submit a pull request or open an issue for any suggestions or bug reports.