DC.NotificationService 1.1.1

dotnet add package DC.NotificationService --version 1.1.1
NuGet\Install-Package DC.NotificationService -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DC.NotificationService" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DC.NotificationService --version 1.1.1
#r "nuget: DC.NotificationService, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DC.NotificationService as a Cake Addin
#addin nuget:?package=DC.NotificationService&version=1.1.1

// Install DC.NotificationService as a Cake Tool
#tool nuget:?package=DC.NotificationService&version=1.1.1

DC Notification Service

About The Project

The DC Notification Service is a .NET 7 based library designed to simplify the process of sending various types of notifications such as emails, SMS, and push notifications. It abstracts the complexity of dealing with different notification providers and offers a unified interface to send notifications with just a few lines of code.

Features

  • Extensible Notification Providers: Easily integrate with any email, SMS, or push notification service provider.
  • Runtime Provider Selection: Choose which notification service to use at runtime, offering flexibility for different environments and scenarios.
  • Support for Multiple Notification Types: Emails with support for HTML content, multiple recipients, CC, and BCC; SMS notifications; Push notifications.

Getting Started

To get started with the DC Notification Service, install the package via NuGet, configure your service provider, and you're ready to send notifications.

Installation

Install the package with NuGet:

dotnet add package DC.NotificationService

Configuration

Configure the services in your Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    // Configure your notification services here
    services.AddEmailService(settings:new EmailSettings()
    {
        EnableSsl = true,
        Host = "smtp-host",
        Port = 2525,
        Password = "mail-password",
        Username = "mail-username",
        From = "test@mail.com"
    });
}

Usage

Inject the INotificationServiceFactory to create and send notifications:

public class NotificationController : ControllerBase
{
    private readonly INotificationServiceFactory _notificationFactory;

    public NotificationController(INotificationServiceFactory notificationFactory)
    {
        _notificationFactory = notificationFactory;
    }

    public async Task<IActionResult> SendNotification()
    {
        EmailMessage emailMessage = new EmailMessage
        {
            To = new List<string> { "test@mail.com" },
            Subject = "Welcome to DC Notification Service",
            Content = "<p>This is a test email.</p>",
            IsHtml = true
        };

        await _notificationFactory.SendEmail(emailMessage);

        return Ok("Notification sent successfully.");
    }
}

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Don't forget to give the project a star 😃 Thanks again!

To-Do

  • Integrate Twilio for SMS notifications.
  • Integrate MailChimp for email services.
  • Integrate Firebase for push notifications.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 146 1/2/2024
1.1.0 101 12/24/2023
1.0.0 112 12/19/2023