{"id":21940163,"url":"https://github.com/softeq/netkit.notification","last_synced_at":"2025-03-22T15:13:37.784Z","repository":{"id":38022996,"uuid":"165244637","full_name":"Softeq/NetKit.Notification","owner":"Softeq","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-08T04:29:17.000Z","size":147,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-01-27T14:53:44.850Z","etag":null,"topics":["dotnet","dotnetcore","microservice","netkit","notification"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Softeq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T13:01:33.000Z","updated_at":"2019-06-24T09:41:21.000Z","dependencies_parsed_at":"2023-01-24T10:20:22.979Z","dependency_job_id":null,"html_url":"https://github.com/Softeq/NetKit.Notification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FNetKit.Notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FNetKit.Notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FNetKit.Notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softeq%2FNetKit.Notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Softeq","download_url":"https://codeload.github.com/Softeq/NetKit.Notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244973775,"owners_count":20541025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","dotnetcore","microservice","netkit","notification"],"created_at":"2024-11-29T02:29:24.115Z","updated_at":"2025-03-22T15:13:37.764Z","avatar_url":"https://github.com/Softeq.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Azure DevOps builds](https://img.shields.io/azure-devops/build/SofteqDevelopment/NetKit/19.svg)\n\n# Softeq.NetKit.NotificationService\n\nSofteq.NetKit.NotificationService is a RESTful microservice that allows to quickly bring notification support to a developing solution.\nService supports the following notification types: \n1. Push via Azure Notification Hub\n2. Email via SendGrid\n3. SMS via Twilio\n\nAPI is written in ```Asp.Net Core 2.0``` and secured with ```OAuth2``` protocol. \n```Swashbuckle``` is enabled to provide API consumers with the documentation.\n\nAPI has an integration with [Softeq.NetKit.EventDriverCommunication] (https://github.com/Softeq/EventDrivenCommunication) to enable sending notification requests via Message Bus.\n\n# Getting Started\n\n## Explore \n\nService exposes the following APIs:\n\n1. ```/settings``` API to initialize new user settings, read and manage;\n2. ```/notifications``` API to send new notifications;\n3. ```/notifications/history``` API to view and delete notification history assoicated to a particular user;\n4. ```/notifications/push/subscription``` API to subscribe or unsubscribe user's mobile devices to receive Push notifications;\n\n## Configure\n\n1. Configure Data Storage: \n    The microservice supports multiple storages: \n        SQL - implemented in ```Softeq.NetKit.Notifications.Store.Sql```\n        NoSQL via Azure CosmosDB - implemented in  ```Softeq.NetKit.Notifications.Store.CosmosDB```\n\n    When desired data storage is chosen, \n    * Add a reference to a data store implementation to  ```Softeq.NetKit.Notifications.Web``` project\n    * Add Automapper configuration to Startup.cs\n\n    ```csharp\n        services.AddAutoMapper(typeof(Service.ContainerModule).Assembly,\n                    typeof(Store.Sql.ContainerModule).Assembly);\n    ```\n\n    * Register Autofac module in DI container\n\n    ```csharp\n        builder.RegisterModule(new Store.Sql.ContainerModule());\n    ```\n\n2. Update ```appsettings.json``` by configuring storage connection strings, API keys\n\n## Develop\n\n1. Add new event to ```Softeq.NetKit.Notifications.Domain.Models.Notification.NotificationEvent``` enum\n```csharp\n    public enum NotificationEvent\n    {\n        MyNewCustomEvent = 0\n    }\n```\n\n2. Modify ```Softeq.NetKit.Notifications.Service.NotificationSenders.NotificationEventConfiguration``` by specifying what notification type will support newly-added event\n```csharp\n    public static Dictionary\u003cNotificationType, IList\u003cNotificationEventConfiguration\u003e\u003e Config = new Dictionary\u003cNotificationType, IList\u003cNotificationEventConfiguration\u003e\u003e\n        {\n            {\n                NotificationType.Email, new List\u003cNotificationEventConfiguration\u003e\n                {\n                    new NotificationEventConfiguration(NotificationEvent.MyNewCustomEvent, true)\n                }\n            },\n            {\n                NotificationType.SMS, new List\u003cNotificationEventConfiguration\u003e\n                {\n\t\t\t\t\tnew NotificationEventConfiguration(NotificationEvent.MyNewCustomEvent)\n                }\n            },\n            {\n                NotificationType.Push, new List\u003cNotificationEventConfiguration\u003e\n                {\n                    new NotificationEventConfiguration(NotificationEvent.MyNewCustomEvent)\n                }\n            }\n        };\n```\n\n3. Implement Notification message per supported notification type under ```/NotificationSenders/NOTIFICATION_TYPE/Messages```\n    * For Push notification\n    ```csharp \n        public class MyNewCustomEventPushMessage : PushNotificationMessage\n        {\n            [JsonProperty(\"someId\")]\n            public Guid SomeId { get; set; }\n\n            public MyNewCustomEventPushMessage()\n            {\n                NotificationType = (int)NotificationEvent.MyNewCustomEvent;\n                BodyLocalizationKey = \"MyNewCustomEvent_body\";\n                TitleLocalizationKey = \"MyNewCustomEvent_title\";\n            }\n        }\n    ```\n\n    * For Email notification\n    ```csharp \n        public class MyNewCustomEventEmailModel : IEmailTemplateModel\n        {\n            public Guid SomeId { get; set; }\n        }\n\n        public class MyNewCustomEventEmailMessage : BaseEmailNotification\u003cMyNewCustomEventEmailModel\u003e\n        {\n            public MyNewCustomEventEmailMessage(string toEmail, string toName, MyNewCustomEventEmailModel model) : base(new RecipientDto(toEmail, toName))\n            {\n                TemplateModel = model;\n            }\n        }\n    ```\n\t\n\t* For Sms notification\n    ```csharp \n        public class MyNewCustomEventSmsModel : ISmsNotification\n        {\n            public string CustomField { get; set; }\n        }\n\n        public class MyNewCustomEventSmsMessage : BaseSmsNotification\n        {\n            public MyNewCustomEventSmsMessage()\n            {\n                \n            }\n        }\n    ```\n\n3. Implement Validator per supported Notificationn Type under ```/NotificationSenders/NOTIFICATION_TYPE/Validators```\n    * For Email notification\n    ```csharp \n        internal class MyNewCustomEventEmailMessageValidator : BaseEmailValidator\u003cMyNewCustomEventEmailMessage\u003e\n        {\n            public MyNewCustomEventEmailMessageValidator()\n            {\n                RuleFor(x =\u003e x.TemplateModel.SomeId).NotEqual(Guid.Empty);\n            }\n        }\n    ```\n\n    * For Push notification\n    ```csharp \n        internal class MyNewCustomEventPushMessageValidator : BasePushMessageValidator\u003cMyNewCustomEventPushMessage\u003e\n        {\n            public MyNewCustomEventPushMessageValidator()\n            {\n                RuleFor(x =\u003e x.SomeId).NotEqual(Guid.Empty);\n            }\n        }\n    ```\n\t\n\t* For Sms notification\n    ```csharp \n        internal class MyNewCustomEventSmsMessageValidator : BaseSmsValidator\u003cMyNewCustomEventSmsMessage\u003e\n        {\n            public MyNewCustomEventSmsMessageValidator()\n            {\n                RuleFor(x =\u003e x.CustomField).NotEqual(string.Empty());\n            }\n        }\n    ```\n\n4. Update MessageFactory under ```/NotificationSenders/NOTIFICATION_TYPE/***MessageFactory.cs```\n\n5. Add localization info under ```/NotificationSenders/NOTIFICATION_TYPE/Resources```\n\n## About\n\nThis project is maintained by Softeq Development Corp.\n\nWe specialize in .NET core applications.\n\n## Contributing\n\nWe welcome any contributions.\n\n## License\n\nThe Query Utils project is available for free use, as described by the [LICENSE](/LICENSE) (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofteq%2Fnetkit.notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofteq%2Fnetkit.notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofteq%2Fnetkit.notification/lists"}